Hi folks,

I've got a little problem with a - at least I think so - correct SQL- statement:

three tables, two referencing the 1st one

---
SELECT * FROM PRIM AS P
WHERE NOT EXISTS
(
SELECT REFID FROM REF1 WHERE REF1.REFID=P.ID
UNION
SELECT REFID FROM REF2 WHERE REF2.REFID=P.ID
);
---

chokes with "SQL error: no such column: P.ID"; as long as I do not use
a WHERE statement in the 2nd 'inner' SELECT statement, it works as expected.

I've worked around this by creating a VIEW from the union of the two
referencing tables so I do not need the UNION in the original query.

Is this a bug or did I just not get the docs?


thanks,

-Markus


PS: sqlite really rocks & the C-API doc is very nice!

---
Markus W. Weissmann
http://www.mweissmann.de/
http://www.opendarwin.org/~mww/

Reply via email to