4 messages in com.mysql.lists.mysqlIs this standard SQL?
FromSent OnAttachments
Paul van den Berg13 Sep 2000 09:28 
James Treworgy13 Sep 2000 09:34 
Paul van den Berg14 Sep 2000 02:20 
Benjamin Pflugmann23 Sep 2000 20:20 
Subject:Is this standard SQL?
From:Paul van den Berg (P.B.@farm.rug.nl)
Date:09/13/2000 09:28:33 AM
List:com.mysql.lists.mysql

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 ?