SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Transpose
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aditis
Starting Member

1 Posts

Posted - 08/14/2013 :  08:26:38  Show Profile  Reply with Quote
I have a table like this:
ID Q1 A1 Q2 A2
R 1 A B C D

and I want the result to be like this:

ID Q A
R1 1 A B
R2 1 C D

Please tell me the query to solve this

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 08/14/2013 :  08:37:57  Show Profile  Reply with Quote
SELECT ID, Q1 AS Question, A1 Answer FROM tableName
UNION ALL
SELECT ID, Q2, A2 FROM tableName

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000