select - MySQL - sum column value(s) based on row from the same table - Stack Overflow
I'm trying to get 'Cash', 'Check' and 'Credit Card' totals in new columns based on ProductID from the same table. Table - Payments ... I think you're making this a bit more complicated than it needs to be. SELECT ProductID, SUM(IF(PaymentMethod = 'Cash .....