Hi Rhino, I don't think that answer solves the problem. I do use a programming language, and doing a query like this means I can make use of the database engine and not add overhead to my application.
Cheers, Luke Venediger. On Wed, 27 Oct 2004 17:26:56 -0400, Rhino <[EMAIL PROTECTED]> wrote: > > ----- 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 > > -- Get Firefox Browser! Reclaim the web. http://getfirefox.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]