Using Native Query Multiple Queries Single Resultset

463 views Asked by At

Using JPA, I am trying to fetch data from different tables and to have it in single result list using query:

SELECT x.a, y.b FROM (SELECT * from a) as x, (SELECT * FROM b) as y

However it is throwing an exception:

Caused by: com.sap.sql.sqlparser.CommonSQLParserException: - 1:256 - SQL syntax error: not a table reference
- 1:256 - Intermediate-SQL syntax error: table reference must be a table name
- 1:261 - SQL syntax error: arguments in FROM clause of SELECT must be tables or a JOIN of tables
- 1:423 - SQL syntax error: not a table reference
- 1:423 - Intermediate-SQL syntax error: table reference must be a table name
- 1:527 - SQL syntax error: not a table reference

Please adivse on how to resolve or reconstruct the above query.

0

There are 0 answers