I really appreciate your quick response,
anyway the problem was,I have missed the 'DISTINCT'keywo rd in every SUM() function,I can re-write the solution as follows, which gives me the exact functionality I need.
Thank you.
Code:
SELECT DISTINCT U.date,SUM(DISTINCT I.amount)AS 'Income' ,SUM(DISTINCT A.amount) AS 'Cost' FROM (SELECT date from `income`GROUP BY date UNION
Leave a comment: