On 28 Aug 2018, at 5:32pm, Richard Hipp <[email protected]> wrote:
> I suppose:
>
> SELECT * FROM A WHERE nam NOT IN (SELECT nam FROM B);
Depending on how many names the tables have in column, a possible alternative
might be to use the EXCEPT compound operator here. Something like
SELECT nam FROM A
EXCEPT
SELECT nam FROM B
This will give you just the 'nam' values. If that's all you need it might be
faster than the "NOT IN" version. If you need more columns than just "nam"
then use something like
SELECT * FROM A WHERE nam IN (
SELECT nam FROM A
EXCEPT
SELECT nam FROM B
)
But this might be slower than the version Dr Hipp gave.
Make sure you have an index on both A.nam and B.nam to test the fastest these
queries can return a result.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users