I am helping someone with an ugly join (well, they are all ugly to me). They have two tables with payroll data that they need to join together in a report. The following are the tables:
What he needs is a SELECT statement that would return the following fields:
The wrenches in this are as follows:
1. Join the tables on PERIODID's and SSN's
2. Return data from every row of TR_PAYLIST and that data from TR_PAYDETAILS that corresponds to it (Left Join?).
3. GROUP BY ADPFILENO, TEMPRATE, ADPCODE, PAYCODE
4. SUM the AMOUNT column
Any assistance would be greatly appreciated. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
Code:
TR_PAYLIST
Name Null? Type
PERIODID NOT NULL NUMBER
SSN NOT NULL VARCHAR2(9)
NAMELAST VARCHAR2(30)
NAMEFIRST VARCHAR2(25)
NAMEM VARCHAR2(15)
ADPFILENO NUMBER
ADPDEPTID VARCHAR2(10)
ADPBATCHID VARCHAR2(10)
DEPTID VARCHAR2(10)
MANID1 VARCHAR2(10)
MANID2 VARCHAR2(10)
ADDED DATE
ADDEDBY VARCHAR2(15)
UPDATED DATE
UPDATEDBY VARCHAR2(15)
CANCELPAY CHAR(1)
TR_PAYDETAIL
Name Null? Type
PERIODID NUMBER
SSN VARCHAR2(9)
PDDATE DATE
PAYCODE VARCHAR2(10)
ADPCODE VARCHAR2(10)
AMOUNT NUMBER(9,4)
TEMPRATE NUMBER(9,4)
PDNOTES NCLOB
ADDED DATE
ADDEDBY VARCHAR2(15)
UPDATED DATE
UPDATEDBY VARCHAR2(15)
Code:
TR_PAYLIST.ADPFILENO,
TR_PAYDETAILS.ADPCODE,
TR_PAYDETAILS.PAYCODE,
TR_PAYDETAILS.TEMPRATE,
SUM(TR_PAYDETAILS.AMOUNT) AS amt
1. Join the tables on PERIODID's and SSN's
2. Return data from every row of TR_PAYLIST and that data from TR_PAYDETAILS that corresponds to it (Left Join?).
3. GROUP BY ADPFILENO, TEMPRATE, ADPCODE, PAYCODE
4. SUM the AMOUNT column
Any assistance would be greatly appreciated. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.