Method: Sequel::ExcludeOrNull#exclude_or_null_having
- Defined in:
- lib/sequel/extensions/exclude_or_null.rb
#exclude_or_null_having(*cond, &block) ⇒ Object
The same as exclude_or_null, but affecting the HAVING clause instead of the WHERE clause.
DB[:items].select_group(:name).exclude_or_null_having{count(name) < 2}
# SELECT name FROM items GROUP BY name HAVING NOT coalesce((count(name) < 2), true)
50 51 52 |
# File 'lib/sequel/extensions/exclude_or_null.rb', line 50 def exclude_or_null_having(*cond, &block) add_filter(:having, cond, :or_null, &block) end |