couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: sort by reduce value
Date Mon, 10 Aug 2009 19:58:48 GMT
On Tue, Aug 11, 2009 at 12:05:28AM +0530, Anand Chitipothu wrote:
> I'm trying to think of couchdb equivalent of the following SQL query.
> SELECT author, count(*)  as count FROM changes GROUP BY author ORDER BY count

Being cheeky, I will point out that you can probably implement this in a
_list view. But this is probably less efficient than just downloading the
result set to the client and sorting it there.

I'm assuming you know that you can get each author's count using a reduce
view, and then query that with group=true, so you'll already have calculated
authors and counts. It's just the final sort by count which remains to be
done client-side.



View raw message