0
I have this order table, I need to count the total order of each user and the total order of each user in the current month
| id | id_user | name | data_criacao |
| 1 | 10 |Pedro | 2018-05-01 |
| 2 | 10 |Pedro | 2018-05-03 |
| 3 | 15 |Joao | 2018-05-04 |
| 4 | 10 |Pedro | 2018-05-10 |
| 5 | 18 |Maria | 2018-05-07 |
I made that select
that brings the name and total order of each user, but I need to bring the total order of each user in the current month, but I’m not getting.
select name, count(*) as total from pedidos group by id_user;
| name | total month | general total | | Pedro| 2 | 22 | | Maria | 3 | 10 | I needed to return a result like this.
– Daywison Ferreira Leal