11-30-2007, 10:54 PM
|
#7 (permalink)
|
|
The Wanderer
Join Date: Nov 2007
Location: El Paso, TX
Posts: 7
Thanks: 1
|
I've always found COALESCE to be very useful.
6: COALESCE
Returns the first non null entry
Code:
SELECT COALESCE (column1, column2, '') from table
Result: if column1 not null, then returns column1, if column1 is null and column2 is not, then will return column2, if both column1 and column2 is null, will return an empty string.
Extremely useful when you need to check for a null statement or need to set a flag if a value is null.
|
|
|