I have a table with three columns in which one of the columns has the client_id (columnA), in the second the orders made (columnB) and in the last one the order date (columnC)
columnaA columnaB columnaC
1 26 2018-02-09
1 15 2018-02-10
2 4 2018-02-09
3 32 2018-02-09
3 18 2018-02-10
I need to get the total of orders from each client in a range of dates
(2018-02-01 / 2018-02-28)
columnaA columnaB(sum_total)
1 41
2 4
3 50
I have tried this query but it only takes me one record:
SELECT distinct columnaA, sum(columnaB) as total FROM tabla.pedidos
where columnaC BETWEEN '2018-02-01' AND '2018-02-28';
columnaA columnaB(total)
1 95