List:General Discussion« Previous MessageNext Message »
From:Luke Venediger Date:October 22 2004 2:31pm
Subject:Conditional statement: IF
View as plain text  
Hi,

I'm trying to write a conditional statement in my query. Is the
following possible in MySQL?

IF(@SomeValue = 1)
THEN
 SELECT "The value is 1";
ELSE
 SELECT "The value is not 1";
END IF

I've tried different variations and nothing seems to be working (I'm
getting syntax errors). I'm using MySQL 4.0.18. Any help would be
greatly appreciated.

Thanks,
Luke Venediger.

-- 
Get Firefox Browser! Reclaim the web. http://getfirefox.com/
Thread
Conditional statement: IFLuke Venediger22 Oct
  • Re: Conditional statement: IFRhino22 Oct
  • Re: Conditional statement: IFAnders Karlsson22 Oct
    • Re: Conditional statement: IFLuke Venediger22 Oct
      • Re: Conditional statement: IFAnders Karlsson22 Oct