How to select records as columns in SQL

Posted by Leigh on Stack Overflow See other posts from Stack Overflow or by Leigh
Published on 2011-02-01T15:19:51Z Indexed on 2011/02/01 15:25 UTC
Read the original article Hit count: 261

Filed under:

Hi,

I have two tables: tblSizes and tblColors. tblColors has columns called ColorName, ColorPrice and SizeID. There is one size to multiple colors. I need to write a query to select the size and all the colors (as columns) for a that size with the price of each size in its respective column.

The colors must be returned as columns, for instance:

SizeID : Width : Height : Red : Green : Blue  
1---------220-----220----£15----£20-----£29 

Hope this makes sense
Thank you

© Stack Overflow or respective owner

Related posts about sql