Turn 3 column table in 2-dimensional matrix in MySQL -


I have a table that looks like this:

  color | Size | Delivery time -------------------- Red | S | 1 red | M | 3 red L 5 black | S | 2 black | M | 4 black | L 6   

Now I would like to replace the table like this:

  S | M | L --------- red 1 | 3 | 5 black 2 4 | 6   

Background: Depending on the color and size, the delivery time for a T-shirt is different, say, each color is not available in every color and the sizes are not fixed , E.g. Female size may start from 36,38,40 in place of S, M, L. So what puzzles do I get, how to convert the values ​​of the first table into the second column column capability dynamically?

The list of valid values ​​for sizes is very large, to make just one big table out of it.

I would like to do this in MySQL, e.g. as a function. The only other option I can think is that it is doing in another language, because the output will be in HTML, I really do not know how I should do it.

If I have to group it by the right color and size. You can get the same data by adding GROUP by color, size at the end of your query. You can format your data while outputting HTM.

To get the most SQL you can not see it in the context of data matrix.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -