----- Original Message ----- From: "Luke Venediger" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 27, 2004 4:58 PM Subject: Select with an IF statements
> Hi, > > I'm trying to do the following: > > SELECT > IF((ProductStatus IS NOT NULL), "Available", "Not Available") as ProductStatus > FROM > tb_Product > WHERE > ProductName = "MyProduct"; > > It works fine if the ProductName "MyProduct" works, and returns > "Available". However, if the product name doesn't work the query > doesn't return any rows. I would like it to return "Not Available" if > the product isn't found. > > Is there a better way to do this? > Yes; use a programming language like Java, Perl or PHP. Rhino -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]