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
 General SQL Server Forums
 New to SQL Server Programming
 Moving Table Data

Author  Topic 

dnhart13
Starting Member

1 Post

Posted - 2011-02-24 : 03:04:44
Greetings...
is there any way to view some data into new column in 'view' table

i have this kind of table

Name value1 value2 value3 group
mmm 1 4 null A
nnn 2 5 null B
ooo 3 6 null C
mmm null null 7 D
nnn null null 8 D
ooo null null 9 D

i want to view that table like this one

Name value1 value2 value3 group
mmm 1 4 7 A
nnn 2 5 8 B
ooo 3 6 9 C

so i match the group D value to Name column...

Thank You B4

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-24 : 03:09:25
[code]
select Name, sum(value1) as value1, sum(value2) as value2, sum(value3) as value3, min(group) as group
from yourtable
group by Name
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -