Hello again to everyone.
I'm having trouble with the following query:
SELECT tables.id FROM (
SELECT table4.location, table4.id
FROM table1
INNER JOIN table2 ON (table1.class_id = table2.class_id)
INNER JOIN table3 ON (table2.name_id = table3.name_id)
INNER JOIN table4 ON (table4.id = table3.id)
INNER JOIN table5 ON (table4.table5_id = table5.id)
) AS files GROUP BY tables.id
;

I know the query doesn't look useful like this, but with WHERE and UNION ALL it will be (for me). The problem is I can't get passed here. SQLite gives me a "SQL error: no such column: tables.id" even if I remove the GROUP by, I still revieve the error. It seems that SQLite cannot reference aliased columns properly from the derived table. Am I right or is there a problem with my SQL? This works fine in MySQL. I can even remove the alias and reference the column by its original table name. However thats not possible in SQLite either.
Any ideas appreciated once again, thank you.
- Dave


Reply via email to