If you are trying to get a single line like,
Eeun eedpt plbemp eenam plbbg1
plbhrs plbptp
Y 081 890 Smith, Mike 081 5.00 OH

Then the following should work
SELECT eeun, eedpt, plbemp, eenam, plbbg1, sum(plbhrs) , plbptp
FROM PRLBH, EEMP WHERE PLBEMP = EEENO and
PLBPTP in('CO','OH', '6D','7D','OG') and
EETDT = 0 and EEDPT = '081' and PLBWDT = 20090115
GROUP BY PLBEMP,EENAM,PLBBG1, PLBPTP,EEUN, EEDPT
Order by PLBEMP

Jeff

-----Original Message-----
Subject: Need help with SQL group by

I have a sql statement that I cannot get to work the way I want.
The statement as it currently exists is.
SELECT eeun, eedpt, plbemp, eenam, plbbg1, plbhrs , plbptp
FROM PRLBH, EEMP WHERE PLBEMP = EEENO and
PLBPTP in('CO','OH', '6D','7D','OG') and
EETDT = 0 and EEDPT = '081' and PLBWDT = 20090115
GROUP BY PLBEMP,EENAM,PLBBG1, PLBHRS , PLBPTP,EEUN, EEDPT
Order by PLBEMP

My results look like this

Eeun eedpt plbemp eenam plbbg1 plbhrs plbptp
Y 081 890 Smith, Mike 081 4.00 OH
Y 081 890 Smith, Mike 081 1.00 OH
Y 081 1160 Mead,Kurt 081 3.50 OH
Y 081 1160 Mead,Kurt 081 1.50 OH

I am trying to get 1 record per employee, but I cannot find the correct
solution.
What am I missing here?

Mike


HCSC Company Disclaimer

The information contained in this communication is confidential, private,
proprietary, or otherwise privileged and is intended only for the use of
the addressee. Unauthorized use, disclosure, distribution or copying is
strictly prohibited and may be unlawful. If you have received this
communication in error, please notify the sender immediately at (312)
653-6000 in Illinois; (800)835-8699 in New Mexico; (918)560-3500 in
Oklahoma; or (972)766-6900 in Texas.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.