Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Need Query Something like this >>> Example QUERY == Select (Select Distinct(ProductCode) from PRODUCT) from VehicleSALES


i need sub-query or any other dynamic query
so that
i can select "result of row" can select "as columns names" in SQL

please help if someone can help
Posted

1 solution

refer :
Simple Way To Use Pivot In SQL Query[^]
Using PIVOT and UNPIVOT[^]

if you need to select column names in runtime dynamically check below links
Dynamic PIVOT in Sql Server[^]
Pivot rows to columns dynamically[^]
 
Share this answer
 
v3
Comments
saimm 21-Jan-15 0:20am    
no its not
saimm 21-Jan-15 0:21am    
how can i select row value as "column Names" from pivot table
DamithSL 21-Jan-15 0:25am    
ok, check my updated answer
saimm 21-Jan-15 0:39am    
weldone,, thanks alot

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