Search code examples
rubysequelcoalesce

Does Ruby Sequel have an equivalent for the SQL "coalesce" function?


In SQL in order to avoid getting a NULL value, I can use the "coalesce" function to substitute it like so:

SELECT COALESCE(some_column, 0) FROM some_table;  

But I can't find any way to do the same thing using Sequel.


Solution

  • DB[:some_table].select{coalesce(some_column, 0)}