Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

precisa retornar dois conjuntos de dados com duas cláusulas where diferentes

SELECT budget_id, 
       SUM(IF(type = 'allocation', points, 0)) AS allocated,
       SUM(IF(type = 'issue', points, 0)) AS issued
FROM transactions
GROUP BY budget_id