ali.m.habib (10/10/2013)
if the whole value of this column is null the return is empty , but I need to return value or null
If the value of this column is null, you need to return null or value?
Mission accomplished I'd guess, but I think you mean that if there is no column1ID equal to 5 you need to return NULL.
edit: query I proposed didn't yield correct result in all cases. Working on it...
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP