Hi,

On Thu, 2002-07-25 at 20:40, Kevin wrote:
> Hello,
> 
> I have a query that runs perfectly until one of the items has no value or is
> set to 0:
> 
> SELECT
>     item.*, color.Name AS COLOR,
>     shapecode.Shape AS SHAPE,
>     clarity.Name AS CLARITY
> FROM item, color, shapecode, clarity
> WHERE
>     clarity.ID = item.CLARITY_ID
>     AND shapecode.ID = item.SHAPE_ID
>     AND item.COLOR_ID = color.ID
>     AND ITEM_ID='MA603'
> 
> If the item.CLARITY_ID has no value or a value of 0 (which there is no
> defined value for in the clarity table), then the query fails.
> 
> Can anything be done without adding more login in the code?

Hi, 
I don't know if CLARITY_ID can be NUll, so this will be just a guess.
Try to use the "NULL safe equal" operator '<=>' between clarity.ID and
item.CLARITY_ID like 
...
WHERE
    clarity.ID <=> item.CLARITY_ID
...

Info:
6.3.1.2 Comparison Operators
http://www.mysql.com/doc/C/o/Comparison_Operators.html

---



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to