Really sorry guys, AS files, should indeed be AS tables, thats what does not work. Sorry again for the copy/pasting/editing error. When I remember to name everything correctly, I still can't select anything by table.column sytax that is in the derived table, wether the derived table is aliased or not (I think it has to be aliased in SQLite, but not in mySQL).
So to recap, this is what doesn't work, but I think should.

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 tables GROUP BY tables.id
;

This doesnt work either:
SELECT table4.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)
) GROUP BY table4.id
;

Nor does specifying id only.
Any input would be appreciated, as I cant think of a way I can work around this yet. Thanks


Reply via email to