Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,i have this tblProductAttribute with
HTML
ProductAttributeID|ProductID|AttributeID|AttributeValue|
1|1|Blue
2|2|medium


(AttributeID 1 = Color,2= size)

i want to get result from select query like this
HTML
ProductName|Color|Size
sampleproduct|Blue|Medium


in short i need to get row data to be the column name
please help me.thanks :-)
Posted
Updated 6-Oct-13 14:50pm
v2

You can use PIVOT to achieve it. Follow the example as defined in this example:

Simple Way To Use Pivot In SQL Query[^]
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/[^]

Hope it helps.
 
Share this answer
 
thanks you,i get the idea of using pivot,but i believe that mysql have only group concat function .
 
Share this answer
 
thanks you,i get the idea of using pivot,but i believe that mysql have only group concat function . I have done that,but im facing an error with my select query when i inner join multiple tables.i post my query later.
 
Share this answer
 

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