Re: Order by count

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 16 2010 - 08:12:19 UTC

  • Next message: Marek Å ab: "Re: Order by count"

    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
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Aug 16 2010 - 08:13:02 UTC