I keep getting an error code 1064 using Mysql workbench
----------Code-----------
use sql_invoicing;
select
'Total Invoice',
sum(invoice_total) as 'Total Sales',
sum(payment_total) as 'Total Payment'
from
(
select
i.number as 'Invoice number',
i.client_id,
c.name,
i.invoice_total,
i.payment_total as 'Total Payments',
pm.name
from
invoices i
left join clients c on i.client_id = c.client_id
left join payments p on i.invoice_id = p.invoice_id
left join payment_methods pm on p.payment_method = pm.payment_method_id
where
pm.name is not null
order by
client_id desc
) as 'R'
I am not able to figure out what the syntax error is :(.
Thank you in advance for your help