I think the output is correct. What you've done essentially is:
- create a column "measure"."med_field"
- alias that column to just "med_field"
- get the sum of that "med_field" column.
What did you really want to do? This?
select sum(measure.med_field) as med_field from tabletest;
Then you should inverse the call order:
AggregateFunction<Integer> fieldCount = sum(fieldByName(BigDecimal.class,
"measure", measure.getColumnName())).as(
measure.getColumnName());
... instead of (check out parentheses):
AggregateFunction<Integer> fieldCount = sum(fieldByName(BigDecimal.class,
"measure", measure.getColumnName()).as(
measure.getColumnName()));
Hope this helps,
Lukas
2015-03-27 12:46 GMT+01:00 <[email protected]>:
> Hi,
>
> Jooq not generate alias to AggregateFunction<T> in MySQL
>
> Example:
>
>
> AggregateFunction<Integer> fieldCount = sum(fieldByName(BigDecimal.class,
> "measure", measure.getColumnName()).as(
> measure.getColumnName()));
>
> ...
>
>
> DSLContext create = using(con, SQLDialect.MYSQL);
> create.select(fieldCount).from(TABLE);
>
>
> Generate:
>
> SELECT SUM(med_field) from TABLETEST;
>
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.