Hmm, actually, we already support this syntax:

select(X, Y, Z).distinctOn(A, B).from(...)

https://github.com/jOOQ/jOOQ/issues/1410

Seems that the other issue is a duplicate.

Cheers,
Lukas

2015-06-09 17:46 GMT+02:00 Lukas Eder <[email protected]>:

> Thanks for explaining the motivation. Very interesting, this sounds like
> an excellent blog post. :-)
>
> The main reason why we haven't implemented this yet is syntax. It is a bit
> weird already in PostgreSQL, but how to model it with a DSL? We would need
> an artificial token, as we cannot play with parentheses as PostgreSQL can.
> Would the following feel intuitive?
>
>
> selectDistinctOn(A, B).select(X, Y, Z)
>
>
> Note, as a workaround, you could abuse of jOOQ's .hint() clause. Even if
> that would not read syntactically intuitive, it would produce the desired
> behaviour:
>
> select(X, Y, Z).hint("distinct on (A, B)")
>
>
> Cheers,
> Lukas
>
> 2015-06-09 15:24 GMT+02:00 Ben Hood <[email protected]>:
>
>> Sorry I forgot to mention the motivation for this - in certain more
>> complicated queries it is easier to figure out the intention of
>> DISTINCT ON as opposed to FIND FIRST/PARTITION OVER, even though they
>> are functionally equivalent. This helps when you go back to revisit a
>> largish query and were wondering why a window function was used.
>>
>> On Tue, Jun 9, 2015 at 1:43 PM, Ben Hood <[email protected]> wrote:
>> > Hi Lukas,
>> >
>> > Can I vote for https://github.com/jOOQ/jOOQ/issues/3564 please? Right
>> > now we have to work around DISTINCT ON with a row num clause, so this
>> > would be a welcomed addition.
>> >
>> > Cheers,
>> >
>> > Ben
>>
>> --
>> 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.

Reply via email to