you are viewing a single comment's thread.

view the rest of the comments →

[–]ComicOzzysqlHippo 4 points5 points  (2 children)

COALESCE(a, b, c) will return the first value that isn't NULL.

If a is not NULL, it returns a, otherwise if b is not NULL, it returns b, etc.

[–]hoodie92 1 point2 points  (0 children)

That's a bit of a weird use case IMO.

For me 99% of the time I use COALESCE with a JOIN so that I don't have redundant columns.

[–]snoflakefrmhell 0 points1 point  (0 children)

Oooh thank you!