James Sheridan <[EMAIL PROTECTED]> wrote: > CREATE TABLE [Query] ( > [id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, > [creatorID] INTEGER NOT NULL, > [ownerID] INTEGER NOT NULL, > [type] VARCHAR NOT NULL > ); > CREATE TABLE [UserQuery] ( > [userID] INTEGER NOT NULL, > [queryID] INTEGER NOT NULL > ); > > SELECT Q.* > FROM Query Q, > UserQuery UQ > WHERE UQ.userID = '1' OR > Q.type = 'a'; > > Query has data and records with type = 'a'. > If UserQuery has NO rows the select returns nothing. > If UserQuery has ANY data, even non-matching data, it returns the > expected rows.
Yes, this is as expected. I'm not sure what you mean by "matching data": your conditions in the WHERE clause don't suggest any relationship between Query and UserQuery. You generate a full cartesian product (also known as cross-join). Did you perhaps mean to add UQ.queryID = Q.id as a condition, or something along these lines? Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users