0
I need to return how many fields equal to 0 each record has and rank the one with the most zeros down. Example:
id | col2 | col3 | col4
1 | 1 | 0 | 0
2 | 0 | 0 | 0
3 | 0 | 1 | 4
4 | 0 | 3 | 5
5 | 3 | 2 | 40
The return in this case should be:
id | count(0)
5 | 0
3 | 1
4 | 1
1 | 2
2 | 3
What is your SQL???
– Sr. André Baill
https://stackoverflow.com/questions/31590705/count-how-many-columns-have-a-specific-value
– Pedro Henrique
@Pedrohenrique, I appreciate the effort, but I cannot use queries with sub query, because my table has many fields and many records. The cost in performance is high. Also, there is no APPLY in Mysql.
– Billly Jow