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)
 Need help in creating query

Author  Topic 

manikut
Starting Member

1 Post

Posted - 2007-08-14 : 00:50:04
I have a table in sql with the following output. I want to create a query to give me a resultset so as to give me the TYPEDIST = 9 total ACCOUNT grouped and for TYPEDIST = 14 ACCOUNT grouped in a single query. Can anyone help me please.

DOCNUMBR TYPEDIST ACCOUNT AMOUNT
--------------------- -------- ----------- ------------------------
A0056397 3 242 55.50000
A0056397 9 5788 -52.00000
A0056397 9 5558 -3.50000
A0056397 14 5789 36.90800
A0056397 14 5559 1.67200
A0056397 15 54 -36.90800
A0056397 15 5557 -1.67200

Thanks for the early response

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2007-08-14 : 02:48:17
Hi ,
you can get the total account grouped for each typedist using this query
select typedist, count(account) from docs where (typedist = 9 or typedist = 14) group by typedist
However, you can add a where class if you want to get the results for specific typedists.
Go to Top of Page
   

- Advertisement -