>>>Right, but it was in the original select statement as well. I want to attempt to filter data first as it was using and then apply distance filter. In case of CTE it may not be relevant, but in case of temp table it will.
>>
>>
>>No, this was the original SQL
Re: Getting from distance for geography coordinates Thread #
1529492 Message #
1529521>>
>>Relevant or not - it's sloppy programming to say the least
>
>I don't understand you. If that condition was in the original SQL Statement, do we want to preserve it or not? I assume that this condition does a rough filtering and then distance filtering is more precise. If this assumption is correct, then we may want to use this 'rough' filtering first to get less records and then apply more precise filtering based on the computed column.
Your cte already returns records where the distance is less than or equal to 250
Then why select from the cte the set where the distance is less than or equal to 250 ? You don't need the second where
Gregory