我想做这样的事情
User.select("users.id, count(whatever) as test")
但是 rails 只返回 User.id 而没有计数。我不能使用类似的东西
User.count(whatever)
因为我在一个非常复杂的 SQL 查询中使用了这个 select。是否可以使用 select helper 获取计数值?
我想做这样的事情
User.select("users.id, count(whatever) as test")
但是 rails 只返回 User.id 而没有计数。我不能使用类似的东西
User.count(whatever)
因为我在一个非常复杂的 SQL 查询中使用了这个 select。是否可以使用 select helper 获取计数值?