search for: avg_subject

Displaying 1 result from an estimated 1 matches for "avg_subject".

2008 May 27
2
order complex aggregation results in 'calculate'
...; table from which I would like to retrieve some aggregated data, with an ordering. Something like: Entry.calculate(''avg'', ''thevalue'', { :order=> ''avg_thevalue DESC'' }) which generates the following (Postgres) query: SELECT avg(subject) AS avg_subject FROM logevents ORDER BY avg_subject This works, but the :order option depends on what I think are implementation details of the function calculate: namely the generation of the "AS avg_subject" alias in the query. This becomes painful if I need more complex SQL expressions to get to...