![](/img/trans.png)
[英]How can I count the count-values of Sequel::Dataset#group_and_count
[英]Sequel Dataset Aggregate Count
我正在尝试对表中的字段进行计数,但未正确生成返回的 SQL。
我究竟做错了什么?
ds
是数据集:
term = 'abouts'
puts ds.count(:id).where(kind: term) # => app.rb:179:in `<main>': undefined method `where' for 115:Integer (NoMethodError)
我认为聚合方法可以有像WHERE
这样的条件。
我怎样才能解决这个问题?
找到了:
puts ds.where(kind: term).count
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.