[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Duplicate Row of data on flat file



see attached sql select......

Thanks.

>>> GJANSEN@aflcio.org 10/25/02 02:16PM >>>
It sounds to me as if there must be a join in your query: for some reason, 
those who have amount3s have more than one record in some many-to-one table.

I'd strongly suggest you provide the begin-select paragraph. Otherwise nobody 
will be able to help you.

>>> KParker@magnatrax.com 10/25/02 02:59PM >>>
I'm creating a flat file with sqr for a benefits provider & getting 2 rows of 
output for each employee who has an "Amount 3" (see attached file)....The 
output is correct for everyone who does not have an Amount 3.....I think I need 
to test to see if the employee is the same for the current record as the 
previous & if so then do whatever...Just not sure how to do it...Can anyone 
help with this?

Hope this makes sense..

Thanks,
Kent


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
Begin-Procedure Select-Employees
Begin-Select

A.EMPLID,
A.LAST_NAME,
A.FIRST_NAME,
A.MIDDLE_NAME,
A.BIRTHDATE,
A.ORIG_HIRE_DT,
A.STREET1,
A.STREET2,
A.CITY,
A.STATE,
A.ZIP,
B.EMPLID,
B.FILE_NBR,
B.EMPL_TYPE,
B.LOCATION,
C.EMPLID,
C.TERMINATION_DT,
C.REHIRE_DT,
D.EMPLID,
D.CHECK_DT,
D.AL_DEDCD,
D.AL_AMOUNT,
E.EMPLID,
E.MEMO_CD,
E.AL_AMOUNT,
F.YTD_GROSS_PAY,
F.FILE_NBR

 
 Do Pay-Frequency
 Do Employee-Contribution
 Do Company-Match
 Do 401K-Loan
 Do Middle-Name
 Do Division-Subsidiary
 Do Employee-Type
 Do Write

FROM PS_PERSONAL_DATA A, 
     PS_JOB B, 
     PS_EMPLOYMENT C, 
     PS_AL_CHK_DED D, 
     PS_AL_CHK_MEMO E,
     PS_AL_YTD_DATA F

        WHERE D.CHECK_DT = $date
        AND E.CHECK_DT = $date
        AND (D.AL_DEDCD = 'K01'
        OR D.AL_DEDCD = 'K02')
        AND E.MEMO_CD = 'K  '
        AND A.EMPLID = B.EMPLID 
        AND B.EMPLID = C.EMPLID
        AND C.EMPLID = D.EMPLID
        AND D.EMPLID = E.EMPLID
        AND B.FILE_NBR = F.FILE_NBR
        AND B.EFFDT = (SELECT MAX(EFFDT) FROM PS_JOB B
                WHERE A.EMPLID = B.EMPLID AND
                B.EFFDT >= $date)
                
        ORDER BY A.EMPLID
                
        
End-Select
End-Procedure Select-Employees