Simple Joins not working in H2 Database when giving multiple tables
13,677
Try below query
SELECT a.*, b.name "make", c.name "model"
FROM basicInfo AS a
JOIN make_models AS b
ON a.make = b.id
JOIN make_models AS c
ON a.model = c.id;
Author by
Admin
Updated on June 09, 2022Comments
-
Admin about 2 years
I have many tables and want to retrieve data with joins in H2 Database but a very simple join is not working when given multiple tables.
SELECT a.*, b.name "make", c.name "model" FROM basicInfo AS a, make_models AS b, make_models AS c WHERE a.make=b.id AND a.model = c.id;
While if I join only two tables e.g.: that works but when multiple tables are given it shows query executed successfully but result with 0 rows.
This query is similar to MySQL syntax. Is there something wrong with my query or H2 simply doesn't support it?