Hi, given the following tables:
CREATE TABLE table_1(id INTEGER PRIMARY KEY,column VARCHAR(64));
CREATE TABLE table_2(id INTEGER PRIMARY KEY,column VARCHAR(64));
I realized that the following query isn't valid in SQLite:
SELECT *
FROM
(
table_1
INNER JOIN
(
SELECT *
FROM table_2
WHERE column = 'whatever'
) AS inner_1
ON table_1.id = inner_1.id
);
It returns error message:
SQL error: near "table_1": syntax error
But if I write it like that it works just fine:
SELECT *
FROM
table_1
INNER JOIN
(
SELECT *
FROM table_2
WHERE column = 'whatever'
) AS inner_1
ON table_1.id = inner_1.id
;
It also works fine if I write the query like that:
SELECT *
FROM
(
select * from table_1
INNER JOIN
(
SELECT *
FROM table_2
WHERE column = 'whatever'
) AS inner_1
ON table_1.id = inner_1.id
);
To me the first query should be valid. it seems the SQL engine desn't
like having a table name right after an opening parenthesis. Are there
any standards regarding parenthesis in SQL92?
Thank you
Simon B.