From the example above, I need this result:
ID - 123
total money = $20.00
first money = $7.00
ID - 456
Total money = $19.00
first money = $2.00
#1
this gets my “total money”
select id, sum(money) as “total money” from mylib.myfile
group by id
#2
this ALMOST gets my result for “first money”
select tmdonr, sum(tmamnt) from mylib.myfile
group by tmdonr, tmupdti
having sum(tmamnt) > 0
order by tmdonr, tmupdti asc
**the above returns rows for each date, I only want the first MONEY
entry (11/1/2016 with $5.00)
I'm trying to put these 2 selects together, but it's looking pretty ugly.
Can I accomplish this with one select statement?
Diane Mueller
Association of the Miraculous Medal
As an Amazon Associate we earn from qualifying purchases.
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.