Select select = new Select();
ElementSymbol symbol = new ElementSymbol("c"); //$NON-NLS-1$
select.addSymbol(symbol);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
UnaryFromClause ufc = new UnaryFromClause(new GroupSymbol("m.g1")); //$NON-NLS-1$
SubqueryFromClause sfc = new SubqueryFromClause("y", query); //$NON-NLS-1$
CompareCriteria join = new CompareCriteria(new ElementSymbol("m.g1.a"), CompareCriteria.EQ, new ElementSymbol("y.c")); //$NON-NLS-1$ //$NON-NLS-2$
List crits = new ArrayList();
crits.add(join);
JoinPredicate jp = new JoinPredicate(ufc, sfc, JoinType.JOIN_INNER, crits);
From from2 = new From();
from2.addClause(jp);
Select select2 = new Select();
select2.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
select2.addSymbol(new ElementSymbol("b")); //$NON-NLS-1$
Query query2 = new Query();
query2.setSelect(select2);
query2.setFrom(from2);
helpTest("SELECT a, b FROM m.g1 JOIN (SELECT c FROM m.g2) AS y ON m.g1.a = y.c", //$NON-NLS-1$
"SELECT a, b FROM m.g1 INNER JOIN (SELECT c FROM m.g2) AS y ON m.g1.a = y.c", //$NON-NLS-1$
query2);
}