Hi, Use LEFT JOIN instead of =. In a 1:m relationship, only records that match in both tables are selected. With L.J., the master is always selected even if the record is not present in the child.
Master Id 1 2 3 4 5 Children FK_id Value 1 V1 1 V2 2 V3 Select id, value from Master, Children Where Master.Id = Children.FK_id 1, V1 1, V2 2, V3 Select id, value from Master Left Join Children On Master.Id = Children.FK_id 1, V1 1, V2 2, V3 4, NULL 5, NULL This query is very useful to find records without children Select id, value from Master Left Join Children On Master.Id = Children.FK_id Where value is null Bye and Good Luck. --- Kevin <[EMAIL PROTECTED]> 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? > > Thanks > > --Kevin > > > --------------------------------------------------------------------- > 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 > __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com --------------------------------------------------------------------- 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