The following query in mysql 3.23.22 returns the total number of
records in a table:
mysql> select count(atc like 'R03%') from rec99w;
+------------------------+
| count(atc like 'R03%') |
+------------------------+
| 239008 |
+------------------------+
1 row in set (0.35 sec)
What I really want is this:
mysql> select count(if(atc like 'R03%',1,null)) from rec99w;
+-----------------------------------+
| count(if(atc like 'R03%',1,null)) |
+-----------------------------------+
| 7616 |
+-----------------------------------+
1 row in set (0.35 sec)
It looks like mysql handles true/false values different from null/not null
values.
Am I correct ?
Is this default SQL ?