Mysql
 sql >> Database >  >> RDS >> Mysql

necessario restituire due insiemi di dati con due diverse clausole where

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