Return the number of dates in Mysql

0

I have the table containing the date field.

| Data|
| 2016-06-09   |
| 2016-06-09   |
| 2016-06-09   |
| 2016-06-08   |
| 2016-06-08   |
| 2016-06-05   |
| 2016-06-01   |

I want it to return something like this:

| Data | Quantidade |
| 2016-06-09 | 3 |
| 2016-06-08 | 2 |
| 2016-06-05 | 1 |
| 2016-06-01 | 1 |
    
asked by anonymous 08.02.2018 / 13:27

1 answer

3

Use COUNT and GROUP BY :

SELECT 'Data', COUNT('Data') AS 'Quantidade' FROM sua_tabela
GROUP BY 'Data';
    
08.02.2018 / 13:30