2 messages in com.mysql.lists.mysqlFunctions in where clause
FromSent OnAttachments
Mikey05 Aug 2000 17:19 
Nick Lindridge05 Aug 2000 17:51 
Subject:Functions in where clause
From:Mikey (fr@totalise.co.uk)
Date:08/05/2000 05:19:14 PM
List:com.mysql.lists.mysql

Hello -

Can functions such as IF, ISNULL, IFNULL & DATE_FORMAT be used in the WHERE clause of a query? I am getting syntax errors when trying this, the same code works fine in the select part. E.g. select even.id ,even.event_name ,even.evca_id ,ifnull(evca.id,"null value") ,evca.description_en from events even left join event_categories evca on even.evca_id = evca.id; where (ifnull(evca.id,"X")) = 'X';

Returns:

mysql> where (ifnull(evca.id,"X")) = 'X'; ERROR 1064: You have an error in your SQL syntax near 'where (ifnull(evca.id,"X")) = 'X'' at line 1

regards,

cynic n. 1. Someone further down the road than an idealist. Generally, past the first blind curve. 2. One who persists in seeing the world as it is rather than as it should be.