lundi 25 juillet 2016

Can I count a certain scenario in SQL server?

I have a table looks like this

ID | I  | II | III | IV | V  |
1  | 1  | 0  | NULL|NULL|NULL|
2  |NULL|NULL|NULL | 0  |  1 |
3  | 1  |  0 |  0  |NULL|NULL|
4  |NULL|NULL|NULL |NULL| 1  |
.    .     .    .    .    .
.    .     .    .    .    .  
.    .     .    .    .    .

I am using SQL Server 2014. I am looking to count the number of ID that has the scenario like #1 and #3. Is there a query that can do that? Thanks!

Aucun commentaire:

Enregistrer un commentaire