Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
manticore-projects committed Aug 14, 2021
1 parent cd4b189 commit d2c3712
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/net/sf/jsqlparser/statement/select/Join.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,16 @@ public StringBuilder appendTo(StringBuilder builder) {
} else {
builder.append("JOIN ");
}

builder.append(rightItem).append((joinWindow != null) ? " WITHIN " + joinWindow : "");
for (Expression onExpression: onExpressions) {
builder.append(" ON ").append(onExpression);
}
if (usingColumns.size()>0) {
builder.append(PlainSelect.getFormatedList(usingColumns, "USING", true, true));
}
}


for (Expression onExpression: onExpressions) {
builder.append(" ON ").append(onExpression);
}
if (usingColumns.size()>0) {
builder.append(PlainSelect.getFormatedList(usingColumns, "USING", true, true));
}

return builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4738,4 +4738,10 @@ public void testJoinWithTrailingOnExpressionIssue1302() throws JSQLParserExcepti
"WHERE\n" +
"tbl1.column1 = 123", true);
}

@Test
public void testSimpleJoinOnExpressionIssue1229() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed(
"select t1.column1,t1.column2,t2.field1,t2.field2 from T_DT_ytb_01 t1 , T_DT_ytb_02 t2 on t1.column1 = t2.field1", true);
}
}

0 comments on commit d2c3712

Please sign in to comment.