SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT IFNULL(CAST(YEAR(p.payment_date) AS CHAR), '****') AS income_year, IFNULL(CAST(p.staff_id AS CHAR), '*') AS staff_id, SUM(p.amount) AS total_payments FROM payment p GROUP BY YEAR(p.payment_date), p.staff_id WITH ROLLUP HAVING income_year IS NOT NULL OR staff_id IS NOT NULL ORDER BY income_year ASC, staff_id ASC;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear