SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
WITH tmp AS ( SELECT JSON_OBJECT(name, count(*)) count_fc FROM film_category JOIN category USING(category_id) GROUP BY name ) SELECT JSON_ARRAYAGG(count_fc) AS films_by_category FROM tmp

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear