2013/8/22 Ryan Cornia <ryancor...@gmail.com>

> I've been converting an SQL app to use JOOQ. So far, it has worked great,
> but I have 2 final queries that do a random order on the records.
>
> What is the JOOQ way of doing it without resorting to raw SQL? In raw SQL,
> I do "order by new_id()", by was hoping for .order(RAND), but that doesn't
> work.
>

How doesn't it work? Have you seen the DSL.rand() function?
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#rand()

Of course, plain SQL isn't a bad choice in this case either, if you prefer
using new_id():
    orderBy(DSL.field("new_id()"))

-- 
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 jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to