Remove Duplicates with Caveats
I have a table with rowID, longitude, latitude, businessName, url, caption. This might look like: rowID | long | lat | businessName | url | caption 1 20 -20 Pizza Hut yum.com null How do I delete all of the duplicates, but only keep the one that has a URL (first priority), or keep the one that has a caption if the other doesn't have a URL (second priority) and delete the rest? Here's my looping technique. This will probably get voted down for not being mainstream - and I'm cool with that. DECLARE @LoopVar int DECLARE @long int, @lat int, @businessname varchar(30), @winner int SET @LoopVar =