SQL query for getting data in two fields from one column.
Posted
by AmiT
on Stack Overflow
See other posts from Stack Overflow
or by AmiT
Published on 2010-06-07T19:54:12Z
Indexed on
2010/06/07
20:32 UTC
Read the original article
Hit count: 299
sql
|sql-server
I have a table [Tbl1] containing two fields.
ID as int And TextValue as nvarchar(max)
Suppose there are 7 records. I need a resultset that has two columns Text1 and Text2. The Text1 should have first 4 records and Text2 should have remaining 3 records.
[Tbl1]
ID | TextValue
1. | Apple
2. | Mango
3. | Orange
4. | Pineapple
5. | Banana
6. | Grapes
7. | Sapota
Now, the result-set should have
Text1 | Text2
Apple | Banana
Mango | Grapes
Orange | Sapota
Pineapple |
© Stack Overflow or respective owner