Home > database >  Be urgent! Be urgent! Pray god to move, statistics of SQL
Be urgent! Be urgent! Pray god to move, statistics of SQL

Time:12-03

I recently met a problem, about the statistics of Sql, the above-mentioned

If id leave
===========
1 1
2 0
3 0
4 0
5 1
6 0
7 0
8 1
9 0
10 1
11 0
12 1
13 1


Whether leave, 1 to ask for leave, 0 for not leave
Leadership requirement for the statistics of number did not ask for leave now, but there is a demand, is to group
As above in the table below, SQL query result will appear the following status

Not leave
====
3
2
1
1
0

Namely statistical number between 0 and 1 but to display such grouping, don't know how to set the Sql to, refer to the great god,


  • Related