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 a help..

Author  Topic 

mummy
Starting Member

9 Posts

Posted - 2009-04-30 : 05:51:53
Hi All,

I have a below problem to show the multiple rows in a single row.

Actual Table:
Name Area BDD ISD SGG
AAA XXX 0 0 10
AAA XXX 0 20 0
AAA XXX 30 0 0
BBB YYY 0 0 15
BBB YYY 0 20 0
BBB YYY 30 0 0


Expected Result:
Name Area BDD ISD SGG
AAA XXX 30 20 10
BBB YYY 30 20 15


Please help me.

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-04-30 : 05:57:37
select name,area,max(bdd),max(isd),max(sgg) from tabl group by name,area
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-04-30 : 05:57:57
select name,area,sum(BDD)as BDD,sum(isd) AS ISD, SUM(sgg) AS SGG
from actualtable
group by name,area
Go to Top of Page
   

- Advertisement -