Github user kaspersorensen commented on the pull request:
https://github.com/apache/metamodel/pull/20#issuecomment-96956463
But it is possible to do multiple joins using the existing API, it's just a
bit cumbersome IMO and it has no query parser support. Here is an example:
```
SELECT COUNT(*) FROM
(table1 INNER JOIN table2 ON table1.key1 = table2.key2) a
INNER JOIN table3 ON a.key2 = table3.key3
```
```
Table table1 = ...
Table table2 = ...
Table table3 = ...
FromItem joinPart1 = new FromItem(table1);
FromItem joinPart2 = new FromItem(table2);
FromItem joinPart3 = new FromItem(table3);
SelectItem key1 = new SelectItem(table1.getColumnByName("key"))
SelectItem key2 = new SelectItem(table1.getColumnByName("key"))
SelectItem key3 = new SelectItem(table1.getColumnByName("key"))
FromItem join1 = new FromItem(JoinType.INNER, joinPart1, joinPart2, new
SelectItem[] {key1}, new SelectItem[] {key2});
join1.setAlias("a");
SelectItem key2inJoin1 = new SelectItem(key2, join1);
FromItem join2 = new FromItem(JoinType.INNER, join1, joinPart3, new
SelectItem[] {key2inJoin1}, new SelectItem[] {key3});
Query q = new Query();
q.selectCount();
q.from(join2);
```
Very cumbersome in deed ... We very much need parsing here AND probably
also some more convenience constructors.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---