Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
; with pt as (select year(payment_date) income_year, name staff, sum(amount) total_paiments from payment P join staff_list SL on P.staff_id=SL.id group by income_year, staff with rollup) select income_year, case when staff is null and income_year is not null then 'Year total' when staff is null and income_year is null then 'Total' else staff end staff, total_paiments from pt

Stuck with a problem? Got Error? Ask AI support!

Copy Clear