On Fri, Nov 15, 2013 at 11:44 AM, David Cotter <da...@adobe.com> wrote:

> outside of the parens?
>
> shouldn't it go inside the parens?
> eg: say the playlist ID i want is "57", would i do this?
>

I think it gets the same result either way, right?  But it seems more
likely to use available indices if the playlistID=57 constraint is on the
WHERE clause of the UPDATE rather than the WHERE clause of the inner SELECT.


>
> also: what is the "1" for?
>

The result set of the SELECT inside of EXISTS(...) is ignored.  Return
whatever you like.  I choose the constant 1.



>
> sorry for my newb-ness, still learning!  but fun!
>
>  DELETE FROM playlist
> WHERE EXISTS(SELECT 1 FROM songlist
>              WHERE playlist.playlistID=songlist.playlistID
>                AND playlist.playlistID=57
>                AND songlist.stale)
>
>
>


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

Reply via email to