我正在尝试计算所有姓氏为空的用户。
我正在尝试这些,但它们不起作用
User.where("last_name = ?", "").count
User.where("last_name = ?", nil).count
调用 all 反对 nil 有效,但我仍然需要选择那些 last_name 为空的人。
User.where("last_name != ?", nil).count
我正在尝试计算所有姓氏为空的用户。
我正在尝试这些,但它们不起作用
User.where("last_name = ?", "").count
User.where("last_name = ?", nil).count
调用 all 反对 nil 有效,但我仍然需要选择那些 last_name 为空的人。
User.where("last_name != ?", nil).count