Thanks Paul!

Luke Venediger.


On Wed, 27 Oct 2004 16:17:51 -0500, Paul DuBois <[EMAIL PROTECTED]> wrote:
> At 22:58 +0200 10/27/04, Luke Venediger wrote:
> >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?
> 
> SELECT IF(COUNT(*),"Available","Not Available") As ProductStatus
> FROM
>    tb_Product
> WHERE
>    ProductName = "MyProduct";
> 
> 
> --
> Paul DuBois, MySQL Documentation Team
> Madison, Wisconsin, USA
> MySQL AB, www.mysql.com
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 


-- 
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]

Reply via email to