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
 Old Forums
 CLOSED - General SQL Server
 sql script??

Author  Topic 

tlin5043
Starting Member

26 Posts

Posted - 2004-02-12 : 04:55:28
hello,
i'm a sql server babe,here's my problems,the raw data are

ACCOUNT CURR
A USD
A USD
A USD
A EURO

B USD
B USD
B EURO

C EURO
C EURO

Because i wanna to know each account contains how many different currency. Then i want my report looks like as follows,

ACCOUNT NoOfCurr
A 2
B 2
C 1

i'll appreciate if anyone can give any ideas.

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-02-12 : 05:04:58
SELECT Account, COUNT(DISTINCT Curr) as NoOfCurr
FROM MYTABLE
GROUP BY ACCOUNT
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-02-12 : 07:50:57
quote:
i'm a sql server babe
Well, you're are certainly welcome at this site!

Got any pics handy?

Go to Top of Page
   

- Advertisement -