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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 JOINS faied to write

Author  Topic 

sateesh.sqldba
Starting Member

25 Posts

Posted - 2010-06-22 : 04:27:48
Hello Every ONe plz get me out of this

i have two tables one is having(accuno,accname,usageid)
anther ne is having(usageid,usagetype)

i want count of accno where usagetype='electricity'


and i want to display usagetype,accountname,accountno in select statement


plz plz get me out of this

thank u somuch in advance


sateesh

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-22 : 04:43:42
Join the two tables on usageid, Use COUNT(*) to get the counts, put a group by clause on the usagetype and, if necessary a where clause to limit to the usage types you're interested in.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -