I thought I can do this with a CTE, but for some reason I can't specify a CTE with just one column.
The following will not compile:
DatePath<Date> dt = Expressions.datePath(Date.class, "dt");
SQLQuery query = factory.query().
with(dates, dt).as(
select(SQLExpressions.all).
from(dateRange)
).
select(dt).
from(dates);
I can however define a CTE with two columns without problems:
DatePath<Date> dt = Expressions.datePath(Date.class, "dt");
NumberPath<Integer> dummy = Expressions.numberPath(Integer.class, "dummy");
SQLQuery query = factory.query().
with(dates, dt, dummy).as(
select(SQLExpressions.all, Expressions.ONE).
from(dateRange)
).
select(dt).
from(dates);
So how could I define a CTE that defines the column name for just one column?
I also don't know how I can specify a parameter of type "interval" for the function.
SQLExpressions.relationalFunctionCall(java.sql.Date.class, "generate_series", startDate, DateExpression.currentDate(), "interval '1' month");