Home All Groups Group Topic Archive Search About
Author
30 Jun 2005 7:20 PM
Chris
Hi,
If I have the foll table

table1
1
2
3
4

how can I write a select statement to display the data in one row as

1,2,3,4

Thanks

Author
30 Jun 2005 7:28 PM
Alejandro Mesa
Bunch of ideas from Anith Sen in this link.
http://groups-beta.google.com/group/microsoft.public.sqlserver.programming/msg/2d85bf366dd9e73e


AMB

Show quote
"Chris" wrote:

> Hi,
> If I have the foll table
>
> table1
> 1
> 2
> 3
> 4
>
> how can I write a select statement to display the data in one row as
>
> 1,2,3,4
>
> Thanks
Author
30 Jun 2005 7:35 PM
Jeff Swearingen
Chris,

There is a way to "rotate" the data. But the method you use depends on what
other columns you have in the table.

A great example can be found at the following URL:
http://www.sqljunkies.com/Article/D6053804-239C-4A77-A7A5-12F04E6166B1.scuk

Hope this helps.

Jeff
--
Jeff Swearingen
MSSQL DBA



Show quote
"Chris" wrote:

> Hi,
> If I have the foll table
>
> table1
> 1
> 2
> 3
> 4
>
> how can I write a select statement to display the data in one row as
>
> 1,2,3,4
>
> Thanks

AddThis Social Bookmark Button