This is my sql statement.
JavaScript
x
String sql = "select mydate from mytable";
How can i add new columns to it dynamically with JSqlParser?
For example i want to add “mylocation” column to my sql query:
JavaScript
String sql = "select mydate, mylocation from mytable";
Advertisement
Answer
According to the documentation it should work like this:
JavaScript
Select select = (Select) CCJSqlParserUtil.parse("select mydate from mytable");
SelectUtils.addExpression(select, new Column("mylocation"));