Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT country,
- SUM(IF(product= 'product1', 1,0)) AS `product1`,
- SUM(IF(product= 'product2', 1,0)) AS `product2`,
- SUM(IF(product= 'product3', 1,0)) AS `product3`,
- SUM(IF(product= 'product4', 1,0)) AS `product4`,
- SUM(IF(product= 'product5', 1,0)) AS `product5`,
- COUNT(*) AS total FROM table
- group by country
- Product 1 Product 2 Product 3 Total etc...
- France 103 99 78 280
- Spain 60 22 13 95
- Germany 33 77 30 130
- Product 1 Product 2 Product 3 Total etc...
- All Countries ? ? ? ?
- France 103 99 78 280
- Spain 60 22 13 95
- Germany 33 77 30 130
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement