[Cubicweb] straight forward filtering and ordering in the same rql sentence

Carlos Balderas carlos.balderas at gmail.com
Tue Sep 13 16:06:52 CEST 2011


Hi List!

I have the following schema:

Reference done_for Company
cardinality = '?*'

This means that a "Company" can have several "References" which is the
important point for this question.
What I would like to do is to make a company list ordered by the newest
modification date of its reference.

This rql sentence achieves what I am looking for :
    Any C, MAX(RD) GROUPBY C ORDERBY 2 DESC WHERE R done_for C, R
modification_date RD

But I would like to know if you have any other suggestions to build the rql
sentence?

I have already tried this one:
    DISTINCT Any C ORDERBY RD DESC WHERE C is Company, R done_for C, R
modification_date RD
but I get this error:
** can't sort on variable RD which is linked to a variable in the selection
but may have different values for a resulting row

Any comment will be very appreciated.
Regards
Carlos Balderas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20110913/32c988c7/attachment-0185.html>


More information about the Cubicweb mailing list