Hello fellow Jooqers
I'm having trouble creating an interval in my JOOQ query. Here is what I'm
trying to do, I have a bunch of records with timestamps and I want the ones
created in the last *n *days.
Here is the SQL to illustrate
SELECT *
FROM stuff
WHERE timestamp >= NOW() - INTERVAL '20 days'
And below is my JOOQ query in JAVA
d.select( field("date_trunc('hour', timestamp)").as("ts_hourly"),field("id"
) )
.from( table("stuff") )
.where(condition("timestamp >= NOW() - INTERVAL '{0} day' ", val(days)))
.fetch().stream()
...
However the binding doesn't work (presumably because the {0} is in a string
literal ) and I get the literal '{0} day' in my WHERE clause.
How do I create a INTERVAL literal using bindings?
Thanks!
-Max
--
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.