James Sheridan 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';
That's what trying to sanitize your data/queries gets you :)
The query should have been:
SELECT Q.*
FROM Query Q,
UserQuery UQ
WHERE Q.type = 'a' OR
(Q.id = UQ.queryID AND
UQ.userID = '1');
Basically, I want all queries of type "a" and all the ones that have a record
in
UserQuery with userID = 1 (queries shared to the user).
Related addendum:
In reading it appears that MySQL treats "," as a CROSS JOIN and implements it
effectively as an INNER JOIN.
a) Is this correct?
and b) Is Sqlite acting the same or treating it as a true CROSS JOIN?
I suspect I'm writing things that I've used with MySQL for a while that are
just
not acting the same on Sqlite. That's fine, but I do want to know that if so :)
Thanks yet again.
--
James Sheridan
Tenable Network Security
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users