Click here to Skip to main content
15,909,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table 'question' with only one column 'ID' like this"

ID

image
multiple_name
a. CH4+ 2O2 ? CO2  + 2H2O
b. 2CH4+ 2O2 ? 2CO2  + 2H2O
c. 3CH4+ 2O2 ? 2CO2  + 3H2O
d. 2CH4+ 2O2 ? 2CO2  + 4H2O
multiple_correct
yes
hint


i want these values to store in rows of specific columns in another table .
for example :
my columns
ID   ans1                        ans2                           ans3                       
1     a. CH4+ 2O2 ? CO2  + 2H2O   b. 2CH4+ 2O2 ? 2CO2  + 2H2O    c. 3CH4+ 2O2 ? 2CO2  + 3H2O 

and go on..
can anyone plz help for this??
Posted
Updated 22-May-14 21:02pm
v2
Comments
Pranav-BiTwiser 23-May-14 3:06am    
Use Pivot..
muneeba mujeeb 23-May-14 3:08am    
i cant use pivot bcz pivot requires aggregated func like SUM or MAX but i cant use them in my table

 
Share this answer
 
Comments
muneeba mujeeb 23-May-14 3:12am    
in above links .. pivot function takes MAX arguement. but i dont need this, i just want to simply show these values against specific columns
Try this:
SQL
select 1 id,
(select * from question where left(id,1)='a') ans1,
(select * from question where left(id,1)='b') ans2,
(select * from question where left(id,1)='c') ans3,
(select * from question where left(id,1)='d') ans4
 
Share this answer
 
Comments
muneeba mujeeb 27-May-14 4:47am    
i have tried ur solution but it gives me below error :

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900