Interesting Ben, thank you.  Were you solving an OLAP-type problem too?
 I'd be interested to see how you used truncDay in a  select and/or insert
query.

Ian.


On Thu, Dec 13, 2012 at 11:46 AM, Ben Hood <[email protected]> wrote:

> Hey Ian,
>
> Lukas would be more specific about best practice, but this is how we
> solved the problem:
>
> Field<Date> truncDay = Factory.field("trunc({0}, {1})", SQLDataType.DATE,
> YOUR_FIELD_GOES_HERE, inline("DD"));
>
> HTH,
>
> Ben
>
>
> On Thu, Dec 13, 2012 at 4:34 PM, Ian Clarke <[email protected]> wrote:
>
>> I'd like to aggregate reporting data that is currently stored hourly in a
>> table, such that it is also aggregated by day (I have a column that
>> specifies the interval, HOUR, DAY, or WEEK).
>>
>> Postgres has a useful function called DATE_TRUNC for this, however I am
>> using Jooq with MySql.
>>
>> How can I do this with Jooq?
>>
>> Many thanks,
>>
>> Ian.
>>
>
>


-- 
Ian Clarke
Blog: http://blog.locut.us/

Reply via email to