SQL_Surfer (4/10/2013)
I have difficult understanding this line of codewhere ISNULL(myfield, 'N') = 'Y'
Does this mean
where myfeild is NULL or myfield = 'N' or myfield = 'Y'
The string value 'N' will be provided for the comparision if the value of the column myfield is null.
Personally, I would simply use WHERE myfield = 'Y'. As it is currently coded the clause is not SARGable and will most likely not use an index on the column if one exists.