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
 SQL Server Development (2000)
 transposed agregate SQL help needed

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-13 : 11:28:15
Zoran writes "If we have a table with columns:
a,b,c and with values
1,2,3
2,2,4
1,1,4
2,3,4 for instance, how to return result set in some stored proc
in such a way that result set has as many columns as
distinct values from table column b, values under this column as
described in column c, returned in as many rows as there are
distinct values in column a, which itself should be also returned.
In above case:
ra,R1,R2,R3 ( as there are 1,2,3 distinct values in column b)
1, 4, 3, 4
2, null, 4, 4

many thanks
Zoran"
   

- Advertisement -