Help needed with MySQL query to join data spanning multiple tables with data used as column names
- by gurun8
I need a little help putting together a SQL query that will give me the following resultsets:
and
The data model looks like this:
The tricky part for me is that the columns to the right of the "Product" in the resultset aren't really columns in the database but rather key/value pairs spanned across the data model.
Table data is as follows:
My apologies in advance for the image heavy question and the image quality. This just seemed like the easiest way to convey the information. It'll probably take someone less time to write the query statement to achieve the results than it did for me to assemble this question.
By the way, the "product_option" table image is truncated but it illustrated the general idea of the data structure.
The MySQL server version is 5.1.45.