Does Derby not allow you to select over the returned relation of another query?
For example, this query works fine:
SELECT *
FROM users, stats
WHERE users.uid = stats.uid;
but this query returns an error:
SELECT username, hits
FROM (
SELECT *
FROM users, stats
WHERE users.uid = stats.uid
);
The error reads:
Error: Syntax error: Encountered "<EOF>" at line 1, column 83.
SQLState: 42X01
ErrorCode: 30000
I am used to Oracle where this works fine.
The above query is just an example, I know I can select username, hits originally without the need for a nested query.
As mentioned by xQbert above, Derby requires you to alias tables in an inline query.
The solution to the question is to do this:
SELECT username, hits
FROM (
SELECT *
FROM users, stats
WHERE users.uid = stats.uid
) AS tmp;
Thanks for the help xQbert
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With