@@ -192,6 +192,19 @@ public void testGetTableListFromDelete2() throws Exception {
192192 assertEquals (1 , tableList .size ());
193193 assertTrue (tableList .contains ("MY_TABLE1" ));
194194 }
195+
196+ @ Test
197+ public void testGetTableListFromDeleteWithJoin () throws Exception {
198+ String sql = "DELETE t1, t2 FROM MY_TABLE1 t1 JOIN MY_TABLE2 t2 ON t1.id = t2.id" ;
199+ net .sf .jsqlparser .statement .Statement statement = pm .parse (new StringReader (sql ));
200+
201+ Delete deleteStatement = (Delete ) statement ;
202+ TablesNamesFinder tablesNamesFinder = new TablesNamesFinder ();
203+ List <String > tableList = tablesNamesFinder .getTableList (deleteStatement );
204+ assertEquals (2 , tableList .size ());
205+ assertTrue (tableList .contains ("MY_TABLE1" ));
206+ assertTrue (tableList .contains ("MY_TABLE2" ));
207+ }
195208
196209 @ Test
197210 public void testGetTableListFromInsert () throws Exception {
@@ -470,4 +483,16 @@ public void testExpressionIssue515() throws JSQLParserException {
470483 assertEquals (1 , tableList .size ());
471484 assertTrue (tableList .contains ("SOME_TABLE" ));
472485 }
486+
487+ public void testSelectHavingSubquery () throws Exception {
488+ String sql = "SELECT * FROM TABLE1 GROUP BY COL1 HAVING SUM(COL2) > (SELECT COUNT(*) FROM TABLE2)" ;
489+ net .sf .jsqlparser .statement .Statement statement = pm .parse (new StringReader (sql ));
490+
491+ Select selectStmt = (Select ) statement ;
492+ TablesNamesFinder tablesNamesFinder = new TablesNamesFinder ();
493+ List <String > tableList = tablesNamesFinder .getTableList (selectStmt );
494+ assertEquals (2 , tableList .size ());
495+ assertTrue (tableList .contains ("TABLE1" ));
496+ assertTrue (tableList .contains ("TABLE2" ));
497+ }
473498}
0 commit comments