Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 NEED HELP WITH JOIN

Author  Topic 

jaybeaud
Starting Member

1 Post

Posted - 2010-04-18 : 22:27:48
HEY Im a NOOB and am doing this for a class. All I want to know is how can I get the CUST_CODE values to not repeat.


SELECT INVOICE.CUS_CODE, CUS_BALANCE
FROM INVOICE, CUSTOMER
WHERE CUSTOMER.CUS_CODE=INVOICE. CUS_CODE
ORDER BY CUS_CODE;

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-18 : 22:33:30
you wanted this ?

SELECT INVOICE.CUS_CODE, SUM(CUS_BALANCE)
FROM INVOICE, CUSTOMER
WHERE CUSTOMER.CUS_CODE=INVOICE. CUS_CODE
GROUP BY INVOICE.CUS_CODE
ORDER BY INVOICE.CUS_CODE;



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -