I'm struggling with this query:
SELECT
case strftime('%m',Expenses.Date)
when '01' then 'January'
when '02' then 'Febuary'
when '03' then 'March'
when '04' then 'April'
when '05' then 'May'
when '06' then 'June'
when '07' then 'July'
when '08' then 'August'
when '09' then 'September'
when '10' then 'October'
when '11' then 'November'
when '12' then 'December'
else ''
end as monthName ,
strftime('%m',Expenses.Date) as monthnum,
SUM(Expenses.Amount),
SUM(Incomes.Amount)
FROM Expenses JOIN Incomes
ON Expenses.UserID = Incomes.UserID
GROUP BY strftime('%m',Expenses.Date), strftime('%m',Incomes.Date)
What I'm trying to do is to get sum() of the column Amount from the table Expenses and the sum() of the column Amount from the table Incomes as two different columns in one query but I'm running to an error. Please if someone can help me.