Am Sonntag, den 03.02.2013, 14:00 -0700 schrieb Keith Medcalf:
> > SELECT moz_places.id, moz_places.url, moz_places.title, moz_bookmarks.parent
> >   FROM moz_places, moz_bookmarks
> >  WHERE moz_places.id = moz_bookmarks.fk
> >    and moz_bookmarks.parent = (select id 
> >                                  from moz_bookmarks 
> >                                 where title like '%arbeit%')
> 
> Firstly, are you sure you shouldn't be saying IN rather that = ?

Yep. Correct. Thanks, Keith. No bug!

> 
>  SELECT moz_places.id, moz_places.url, moz_places.title, moz_bookmarks.parent
>    FROM moz_places, moz_bookmarks
>   WHERE moz_places.id = moz_bookmarks.fk
>     and moz_bookmarks.parent = (select id 
>                                   from moz_bookmarks 
>                                  where title like '%arbeit%' limit 1)
> 
> Is what is actually being processed.  
> 
> If the id of the one row (selected by happenchance) satisfying the constraint 
> in the subquery does not happen to have any rows where that id is used in the 
> parent column, you will get no result rows at all.
> 
> You probably mean something like:
> 
>  SELECT moz_places.id, moz_places.url, moz_places.title, moz_bookmarks.parent
>    FROM moz_places, moz_bookmarks
>   WHERE moz_places.id = moz_bookmarks.fk
>     and moz_bookmarks.parent IN (select id 
>                                    from moz_bookmarks 
>                                   where title like '%arbeit%')
> 
> which will return results if ANY of the selected id are used in the parent 
> column, rather than requiring that only the happenchance selected id be used 
> in the parent column.
> 
> ---
> ()  ascii ribbon campaign against html e-mail
> /\  www.asciiribbon.org
> 
> 
> 
> 


-- 
thomas


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to