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, changing to a LEFT JOIN gets around this, but the original question still 
stands :)

Thanks.

--
James Sheridan
Tenable Network Security
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to