Skip to content

Instantly share code, notes, and snippets.

@artnos
Created August 14, 2015 17:51
Show Gist options
  • Save artnos/7f1c04b71ac403ad84b9 to your computer and use it in GitHub Desktop.
Save artnos/7f1c04b71ac403ad84b9 to your computer and use it in GitHub Desktop.
Products
id | name
1 | shirt
2 | pant
ProductDetails
id | product_id | size | inventory
1 | 1 | M | 5
3 | 1 | L | 10
4 | 1 | S | 10
5 | 2 | S | 99
6 | 2 | M | 99
I want to do query that returns this, is this possible?
Product Name | Size S | Size M | Size L
Shirts | 10 | 5 | 10 |
Pant | 99 | 99 | 0 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment