我正在使用以下查询...
SELECT c.idx, c.club_name, s.sale_event_date, s.club_id, COUNT(*) AS total_guests,
sum(s.qr_scanned = 1) AS total_scanned_guests,
SUM(s.rep_sale_commission ON (s.rep_id != 0 AND s.qr_scanned = 1)) AS total_rep_commission,
SUM(s.sale_commission) AS total_admin_fees
FROM club c RIGHT JOIN
sales s ON s.club_id = c.idx
WHERE c.admin_id = 37
GROUP BY s.sale_event_date
ORDER BY s.sale_event_date DESC;
但它抛出了一个 MySQL 错误 -right syntax to use near 'ON (s.rep_id != 0 AND s.qr_scanned = 1)) AS total_rep_commission, SUM(s.' at line 3
我怎样才能解决这个问题?