Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我在 Couchbase 中有一堆文档,如下所示。
user lastUpdate otherField1 a "2015-12-06" 1 a "2015-11-06" 2 b "2015-12-05" 3 b "2015-10-05" 4
如何在单个 N1QL 查询中获取每个用户的最后更新文档?几天前我开始使用N1QL,我不知道如何进行如此复杂的查询。谢谢
您可以执行以下操作:
SELECT user, MAX( [ lastUpdate, doc ] ) AS pair FROM my_bucket AS doc GROUP BY user;