A little help here. I really don't understand how to use this coalesce in MySQL
I have read all the pages in page 1 result of how to use coalsece
in google result.
I know its meaning that it returns the first non-null value it encounters and null otherwise.
But it's still vague for me.
- How come I saw queries that returns multiple values? Isn't it only the first not null value that is returned?
- And how do it decide which column to base?
coalesce(column1,column2)
? what if first column is null and other column is not null?
- Or if I'm wrong or my syntax is wrong, how do i properly write it?
- Can someone provide a very good and simple example on how to use it?
- And when it is desirable to use.
question from:
https://stackoverflow.com/questions/17104329/how-to-use-coalesce-in-mysql 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…