View Single Post
Old 11-30-2007, 10:54 PM   #7 (permalink)
Sand_Devil
The Wanderer
 
Sand_Devil's Avatar
 
Join Date: Nov 2007
Location: El Paso, TX
Posts: 7
Thanks: 1
Sand_Devil is on a distinguished road
Default

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.
Send a message via ICQ to Sand_Devil Send a message via AIM to Sand_Devil Send a message via MSN to Sand_Devil Send a message via Yahoo to Sand_Devil
Sand_Devil is offline  
Reply With Quote
The Following User Says Thank You to Sand_Devil For This Useful Post:
SOCK (12-09-2007)