Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- group by and other columns
October 14, 2005, 12:14 pm
rate this thread
I have an SQL statement such as the following.
"select sum(transaction_amount), file_number, party_code, t_date
group by file_number"
The file_number can be same for many rows but party_code will be
different for each row. How can I get all possible values of party_code
field. Currently I get only the party_code for first record.
Re: group by and other columns
If you want the sum of transactions for each individual party
code: GROUP BY file_number,party_code
If you want the sum of transactions for the whole file_number, but
still want the individual party_codes, use a second query. You are
*NOT* guaranteed to get the party_code for the *first* record. You
will get a party_code for *a* record in the group.
Gordon L. Burditt
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum