> The right way to do this query is: > > SELECT * FROM vals2d WHERE rowid IN > (SELECT rowid FROM vals2d WHERE x=1 > UNION ALL SELECT rowid FROM vals2d WHERE y=1);
Unfortunately this tranform does not work on views or subqueries due to NULL rowids. sqlite> create table abc(a,b,c); sqlite> insert into abc values(4,5,6); sqlite> insert into abc values(3,2,1); sqlite> select rowid, * from abc; rowid|a|b|c 1|4|5|6 2|3|2|1 sqlite> select rowid, * from (select * from abc); rowid|a|b|c |4|5|6 |3|2|1 sqlite> create view vv as select * from abc; sqlite> select rowid, * from vv; rowid|a|b|c |4|5|6 |3|2|1 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com