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)
 Coloumn wise return...

Author  Topic 

somu_p
Starting Member

13 Posts

Posted - 2007-07-11 : 01:49:30
Hi,
I've two tables names mRoles & mSubroles. Here i'm giving the structure and sample datas.

mRoles
======
roleId name
1 User Groups
2 User Types
3 Users

mSubroles
=========
subRoleId roleId name
1 1 Add
2 1 Edit
3 1 View
4 1 Delete

I want to display like this.

roleId name Add Edit View Delete
1 User Groups 1 2 3 4
2 User Types 1 2 3 4
3 Users 1 2 3 4

Kindly help me in this regard.


Thanks & Regards,
P.Somasundaram








khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-11 : 01:54:57
use the PIVOT operator. Refer to BOL on the syntax and example


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

Go to Top of Page
   

- Advertisement -