SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT c.name AS category, COUNT(CASE WHEN f.store_id = 'store_1' THEN 1 END) AS store_1, COUNT(CASE WHEN f.store_id = 'store_2' THEN 1 END) AS store_2 FROM category c LEFT JOIN film f ON c.category_id = f.category_id GROUP BY c.name ORDER BY c.name ASC; ; show status like 'Last_query_cost';

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear