How to get multiple colums in single columns>

Posted by Vforvijay under ASP.NET on 7/8/2011 | Points: 10 | Views : 1159 | Status : [Member] | Replies : 3
hi..
in my table i have field t1,t2,t3,t4..i want this all field data in single column in the field name t...
how to write a query for this....




Responses

Posted by: SheoNarayan on: 7/8/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Write something like this

SELECT t1 + ' ' + t2 + ' ' + t3 + ' ' + t4 + ' ' + t5 as SingleColumn from YourTableName


Here SingleColumn is the combination of all your column values and YourTableName is the name of your database table.

Hope this helps

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 7/8/2011 [Member] Starter | Points: 25

Up
0
Down
hi...i need the data in single column in multiple rows.

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 7/8/2011 [Member] Starter | Points: 25

Up
0
Down
if you are using sql server 2005 or above Try to use PIVOT
http://msdn.microsoft.com/en-us/library/ms177410.aspx

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response