Hi, Can I have the T-SQL query for the following scenario. I have a table with the following list of values and the desired output is as below : create table foo(c int) go insert into foo values (11) insert into foo values (27) insert into foo values (83) insert into foo values (24) go Desired output is as below: c1 c2 --- --- 11 27 27 83 83 24 Many Thanks. -Siva
You need explain a little more as it not obvious from the data how you arrived at the result. Also, the improper formatting is confusing us further. Do you need to transform the rows into columns?
Hi Dinakar, I have reposted the same. It is NOT the transformation of all the rows to columns. But the First and Second rows to be represented as two different columns on the First row , the second and the third rows to be represented on the second row and so on..... Please can I have the reply. -Siva
It sounds like PIVOT type of query, I believe you can select few columns to rws in this case. http://technet.microsoft.com/en-us/library/ms177410.aspx fyi.