Ooops.  This can be further simplified as:

select rowid from a where rowid not in b
union all
select rowid from b where rowid not in a;



>>It looks hairy but here's what it's doing. Given tables A,B:
>
>>1. Do the regular join (all rows with matches in both A and B)
>>2. Find rows in A that aren't in B
>>3. Find rows in B that aren't in A
>>4. Concatenate those 3 queries together with UNION ALL
>
>will be the same as A UNION ALL B, which is much simpler.
>
>I think what the OP wanted was
>
>WITH C AS (select rowid from A INTERSECT select rowid from B)
>select rowid from a where rowid not in c
>union all
>select rowid from b where rowid not in c;
>
>Assuming the rowid's are the same between the tables.
>
>
>
>
>
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to