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 2000 Forums
 Transact-SQL (2000)
 Need help with query

Author  Topic 

tocroi72
Yak Posting Veteran

89 Posts

Posted - 2006-03-08 : 13:46:37
I have a table like this

CompanyNam, Product, TotalQTY
AAA TTT 3
AAA HHH 2
BBB TTT 5
BBB LLL 9
I need it look like below in the report

CompanyName [Count of total] TTT HHH LLL
AAA 5 3 2
BBB 14 5 9

Below is the table script

create table #tmp(company varchar(10), product varchar(10),total smallint)
insert into #tmp select 'AAA','TTT',3
insert into #tmp select 'AAA','HHH',2
insert into #tmp select 'BBB','TTT',5
insert into #tmp select 'BBB','LLL',9

Thank you very much any help.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-08 : 14:04:35
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=3914
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6216

Go with the flow & have fun! Else fight the flow
Go to Top of Page

tocroi72
Yak Posting Veteran

89 Posts

Posted - 2006-03-08 : 14:38:25
Thank you, got it.
Go to Top of Page
   

- Advertisement -