mysql - need to return two sets of data with two different where clausesGet the solution ↓↓↓
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
select budget_ID, sum(case when type = 'allocated' then points else 0 end) as allocated, sum(case when type = 'issued' then points else 0 end) as issued ..rest of your query... group by budget_ID
Cases can be used to sum only when a certain criteria is met.
Share solution ↓
Link To Answer People are also looking for solutions of the problem: your system folder path does not appear to be set correctly. please open the following file and correct this: index.php
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.