Is there a way to set a default value for all returned values that are null, specifically in MySql?
Instead of
SELECT
IFNULL(foo, 0),
IFNULL(bar, 0),
IFNULL(baz, 0)
FROM table
I would like to do something like:
SELECT IFNULL(*, 0)
FROM table
// this does not work, but I'm looking for something like it
A result of a function in SQL is a single value (column), not a list of columns. So there isn't, and can't be, such a construct. You'd have to handle every column individually, unfortunately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With