David Fowler wrote:

SQLite Version 3.2.2.
Is this a bug, or is my SQL that bad?
Query 1:
SELECT * FROM table1, table2
WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id);
This query works perfectly, can't fault it.
But when I do this, SQLite locks out (Command line interface, and PHP5)
Query 2:
SELECT * FROM table1, table2
WHERE ((table1.value LIKE "%value%" AND table1.table2_id = table2.id);

this statement has an extra ; which may be the error. Another thought, when quoting string literals, it is better to use single quotes('), since double quotes(") means identifier --column name-- first, string literal second.

OR (table1.value LIKE "%different_value%" AND table1.table2_id = table2.id)); This query (and even more complex versions of it) works in MySQL (Haven't tried another DB yet) and I'm trying to migrate to SQLite, this is really holding me back.

Any ideas, I'm totaly stuck, currently trying to see if I can get the same results using another piece of SQL that SQLite will like, probably going to end up with a compound statement (UNION most likely I think).


John

Reply via email to