I have 2 tables Sales and return and i have two queries to get each day sales total and return total of certain month. it's result like this.
SELECT strftime('%m/%d', Date) as valDay, SUM(TotalPrice) as valTotal FROM Sales WHERE strftime('%m', Date) ='12' GROUP BY valDay;
Result
valDay valTotal
12/01 50.0
12/02 50.0
12/04 50.0
12/05 120.0
12/06 160.0
12/07 30.0
12/08 80.0
12/09 50.0
and the second query is
SELECT strftime('%m/%d', Date) as valDay, SUM(TotalPrice) as valTotal FROM return WHERE strftime('%m', Date) ='12' GROUP BY valDay;
Result
valDay valTotal
12/01 10.0
12/05 100.0
12/08 20.0
I want to deduct each day return total from same day sales. the result should be like this, ignore the brackets btw
valDay valTotal
12/01 40.0 (50-10)
12/02 50.0
12/04 50.0
12/05 20.0 (120 - 100)
12/06 160.0
12/07 30.0
12/08 60.0 (80 - 20)
12/09 50.0
is it possible to do with a single query ?