You would group on all of them
SELECT employeid, lastname, firstname, payamt, ;
paydate, payhow, checknum, SUM(payamt) ;
FROM appdata!mydata ;
GROUP BY employeid, lastname, firstname, payamt, ;
paydate, payhow, checknum
>Just a little help on this one. Select-sql statements are not my strong point sometimes.
>
>In the following for each person (employid), I need one row with a total for payamt for each employid who's paydate, payhow, and checknum are the same.
>
>So, if one record has:
> employeid = '9875'
> paydate = '06/01/2003'
> payhow = 'Check'
> checknum = '101'
> payamt = 100.00
>
>and another record has:
> employeid = '9875'
> paydate = '06/01/2003'
> payhow = 'Check'
> checknum = '101'
> payamt = 155.00
>
>and another record has:
> employeid = '9875'
> paydate = '06/15/2003'
> payhow = 'Check'
> checknum = '102'
> payamt = 75.00
>
>I need to get 2 rows - one with the $255 payamt, and the 2nd one with the $75 payamt.
>
>
>SELECT Mydata.employeid, Mydata.lastname, Mydata.firstname, Mydata.payamt, ;
> Mydata.paydate, Mydata.payhow, Mydata.checknum ;
> FROM appdata!mydata
>
>
>What GROUP BY would I add to the above statement to give me the results I require?
>
>Mel Cummings
--sb--