I'm trying to do almost same thing as this question but I can't seem to generate my objective after I tried to alter that to my case.
id, type, time, amount
------------
18, depo, 2020-02-02 10:13:00, 30
17, full, 2020-02-02 10:12:00, 100
16, full, 2020-02-01 15:12:00, 100
15, full, 2020-02-01 13:12:00, 100
All I need is to SUM() all group by date, I've done this.
SELECT sum(amount) amount, DATE(time) day
FROM `payment`
GROUP BY DATE(time), type
ORDER BY day, type DESC
It returns two same dates
70, 2020-02-02
100, 2020-02-02
200, 2020-02-01
The operation I need is full minus by (-) depo so on 2020-02-02 I will get 70. Same with other dates. I'm thinking to assign all the data to PHP arrays butt is there an "easier" workaround so I could just call the data straight from the query.
Thanks in advance.