How to add where condition to sql with JSqlParser?
问题 I want to add where condition to sql with JSqlParser, for example: Before: select * from test_table where a=1 group by c After: select * from test_table where a=1 and b=2 group by c However, I cannot find any example codes. 回答1: One solution would be: String sql = "select * from test_table where a=1 group by c"; Select select = (Select) CCJSqlParserUtil.parse(sql); Expression where = CCJSqlParserUtil.parseCondExpression("a=1 and b=2"); ((PlainSelect) select.getSelectBody()).setWhere(where);