Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sum , group by and others

Status
Not open for further replies.

xq

Programmer
Jun 26, 2002
106
NL
i have to select sum of amount in the table cflows which is only group by certain number of deal_no, but i have to select other things as well, the code i've written is:

SELECT deals.deal_no,cparty.code, anacode.name, cparty.deal_ext, mmdeals.bor_invest, Sum(cflows.amount)

FROM anacode, cparty, deals, mmdeals, cflows

WHERE cflows.comments='PRINCIPAL' AND deals.deal_no = mmdeals.deal_no AND deals.deal_no = cflows.deal_no AND deals.cparty = cparty.thekey AND cparty.analyse01 = anacode.thekey

GROUP BY cflows.deal_no, deals.deal_no,cparty.code, anacode.name, cparty.deal_ext, mmdeals.bor_invest

this code doesn't work, is there another way of doing this?thanks for any help!
 
What do you mean when you say it doesn't work - Are you getting an error message or not getting the right results? That way of doing a query should give you the results you want but I notice the first column in your Group By "cflows.deal_no" does not appear in your SELECT statement. That's a no no. If it's more than just that, give us more details.
 
sorry, thanks ur reply, i just fixed the problem. thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top