Prakash Thapa
Prakash Thapa

Reputation: 1285

order by after grouping in RethinkDB

How to order after grouping in Rethinkdb like in sql:

select count(id) as cid, ... from x 
group by y
order by cid desc

Upvotes: 2

Views: 703

Answers (1)

neumino
neumino

Reputation: 4353

If I properly understood your question, the query you are looking for is (in JavaScript)

 r.table("x").group("y").count().ungroup().orderBy("reduction")

In Python/Ruby, it would be

 r.table("x").group("y").count().ungroup().order_by("reduction")

Upvotes: 4

Related Questions