0

I Have this table

|      status      |    month       |      years       |
|                  |                |                  |
|      resign      |     jan        |        2019      |
|      resign      |     jan        |        2019      |
|       Stay       |     feb        |        2019      |
|      resign      |     feb        |        2019      |

I want to sum total status with the same value and by month&years

The result should be this

|      resign      |    month       |        years     |
|         2        |     jan        |        2019      |
|         1        |     feb        |        2019      |
dewey
  • 809
  • 2
  • 16
  • 47

1 Answers1

-1

This should work for you

select count(`status`) as `resign`, `month`, `years`
from t1 
where `status` = 'resign'
group by `month`, `status`, `years` ;

https://www.db-fiddle.com/f/gTTjUEPyynJciKx2DbypKY/8

dewey
  • 809
  • 2
  • 16
  • 47