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.
Author |
Topic |
immad
Posting Yak Master
230 Posts |
Posted - 2014-12-30 : 06:47:34
|
HI,I have a problem.my data is look like this.EvS_VoucherCode--------Name----TotalAmountACT----------------------------1------------------3ACT----------------------------1------------------3DEF----------------------------2------------------4DEF----------------------------2------------------4DEF----------------------------2------------------4i want data looks like this.EvS_VoucherCode--------Name---------TotalAmountACT-------------------------------2-----------------6DEF-------------------------------6------------------12please help me out.thanks for the help.immad uddin ahmed |
|
MuralikrishnaVeera
Posting Yak Master
129 Posts |
Posted - 2014-12-30 : 07:29:34
|
[code]CREATE TABLE #temp(EvS_VoucherCode varchar(100),Name int,TotalAmount int)INSERT INTO #tempSELECT 'ACT',1,3 UNION ALLSELECT 'ACT',1,3 UNION ALLSELECT 'DEF',2,4 UNION ALLSELECT 'DEF',2,4 UNION ALLSELECT 'DEF',2,4SELECT EvS_VoucherCode, SUM(Name), SUM(TotalAmount)FROM dbo.#temp GROUP BY EvS_VoucherCodeDROP TABLE dbo.#temp[/code]---------------Murali KrishnaYou live only once ..If you do it right once is enough....... |
|
|
|
|
|
|
|