Skip to content

Commit 9ce65cd

Browse files
committed
fixes #705
1 parent dd80699 commit 9ce65cd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,9 +1277,9 @@ SelectBody SetOperationList() #SetOperationList:
12771277
)
12781278

12791279
{
1280-
if (selects.size()==1 && selects.get(0) instanceof PlainSelect) {
1280+
if (selects.size()==1 && selects.get(0) instanceof PlainSelect && orderByElements==null) {
12811281
if (brackets.get(0))
1282-
((PlainSelect)selects.get(0)).setUseBrackets(true);
1282+
((PlainSelect)selects.get(0)).setUseBrackets(true);
12831283
return selects.get(0);
12841284
} else {
12851285
list.setBracketsOpsAndSelects(brackets,selects,operations);

src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3629,4 +3629,9 @@ public void testLongQualifiedNamesIssue763_2() throws JSQLParserException {
36293629
public void testSubQueryAliasIssue754() throws JSQLParserException {
36303630
assertSqlCanBeParsedAndDeparsed("SELECT C0 FROM T0 INNER JOIN T1 ON C1 = C0 INNER JOIN (SELECT W1 FROM T2) S1 ON S1.W1 = C0 ORDER BY C0");
36313631
}
3632+
3633+
@Test
3634+
public void testSubQueryOrderByIssue705() throws JSQLParserException {
3635+
assertSqlCanBeParsedAndDeparsed("SELECT a.* FROM ((SELECT T1.SACOJA FROM SOLARB t1) ORDER BY sacoja ASC) a");
3636+
}
36323637
}

0 commit comments

Comments
 (0)