You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marek Šabo <ms...@buk.cvut.cz> on 2010/08/15 14:28:55 UTC
Order by count
Hi,
I'm not sure but is there support in Cayenne EJBQL impl. for ordering by
aggregate functions? (I think JPQL spec. has it)
I'm getting syntax error on these:
SELECT p.account, count(p) FROM PortJump p GROUP BY p.account, ORDER by
count(p) DESC
SELECT p.account, count(p) AS cnt FROM PortJump p GROUP BY p.account
ORDER BY cnt DESC
Thanks for information, regards
--
Marek Šabo
Re: Order by count
Posted by Marek Šabo <ms...@buk.cvut.cz>.
Thanks.
You are right that would add very nice feature along with such code
representatives (query.getCount() ...), for me sql templating is rather
bit cozy. At least you gave there a hint with mapping extra attr. for
some u-cases.
Cheers,
On 08/16/2010 10:12 AM, Andrus Adamchik wrote:
> Oddly (to me at least) JPQL spec does not allow aggregate or other
> functions in ORDER BY. This was discussed just recently on this list:
>
> http://markmail.org/message/ztlqde7brhamdzrf
>
> Something for us to consider adding in the future versions of Cayenne,
> as we are no longer bound by the spec limitations.
>
> Andrus
>
> On Aug 15, 2010, at 3:28 PM, Marek Šabo wrote:
>
>> Hi,
>>
>> I'm not sure but is there support in Cayenne EJBQL impl. for ordering by
>> aggregate functions? (I think JPQL spec. has it)
>>
>> I'm getting syntax error on these:
>>
>> SELECT p.account, count(p) FROM PortJump p GROUP BY p.account, ORDER by
>> count(p) DESC
>>
>> SELECT p.account, count(p) AS cnt FROM PortJump p GROUP BY p.account
>> ORDER BY cnt DESC
>>
>> Thanks for information, regards
>>
>> --
>> Marek Šabo
>>
>>
>
>
--
Marek Šabo
Chief Server Manager
Club SU CTU Buben
Bubenečská Kolej
Terronská 28, Prague 16000
XMPP: zeratul021@gmail.com
Re: Order by count
Posted by Andrus Adamchik <an...@objectstyle.org>.
Oddly (to me at least) JPQL spec does not allow aggregate or other
functions in ORDER BY. This was discussed just recently on this list:
http://markmail.org/message/ztlqde7brhamdzrf
Something for us to consider adding in the future versions of Cayenne,
as we are no longer bound by the spec limitations.
Andrus
On Aug 15, 2010, at 3:28 PM, Marek Šabo wrote:
> Hi,
>
> I'm not sure but is there support in Cayenne EJBQL impl. for
> ordering by
> aggregate functions? (I think JPQL spec. has it)
>
> I'm getting syntax error on these:
>
> SELECT p.account, count(p) FROM PortJump p GROUP BY p.account, ORDER
> by
> count(p) DESC
>
> SELECT p.account, count(p) AS cnt FROM PortJump p GROUP BY p.account
> ORDER BY cnt DESC
>
> Thanks for information, regards
>
> --
> Marek Šabo
>
>