Re: Order by count

From: Marek Šab (msab..uk.cvut.cz)
Date: Mon Aug 16 2010 - 10:04:53 UTC

  • Next message: Nikolaos Paraschou: "How to stop a long running query?"

    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: zeratul02..mail.com
    



    This archive was generated by hypermail 2.0.0 : Mon Aug 16 2010 - 10:03:20 UTC