A subquery in the FROM tableExpression of a subquery, where a RIGHT JOIN is
present, is causing  a Syntax error. The same syntax using LEFT JOIN or an
INNER JOIN works fine. Reorganizing with a LEFT JOIN is a workaround, but
the error on valid SQL is confusing.

H2 1.3.164 (2012-02-03)



DROP TABLE IF EXISTS A;
CREATE MEMORY TEMPORARY TABLE A(a INT);
INSERT INTO A VALUES(1);
DROP TABLE IF EXISTS B;
CREATE MEMORY TEMPORARY TABLE B(b INT);
INSERT INTO B VALUES(2);

-- subqueries within JOIN subqueries: OK
SELECT * FROM (
  SELECT * FROM (SELECT * FROM A) a
  INNER JOIN(SELECT * FROM B) b
) c;

-- subqueries within LEFTJOIN subqueries: OK
SELECT * FROM (
  SELECT * FROM (SELECT * FROM A) a
  LEFT JOIN (SELECT * FROM B) b
) c;

-- subquery within RIGHT JOIN tableExpression subquery only : OK
SELECT * FROM (
  SELECT * FROM A a
  RIGHT JOIN (SELECT * FROM B) b
) c;

-- subqueries within RIGHT JOIN subqueries: Syntax error
SELECT * FROM (
  SELECT * FROM (SELECT * FROM A) a
  RIGHT JOIN B b
) c;


DROP TABLE A;
DROP TABLE B;

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to