Home Forums SQL Server 2005 T-SQL (SS2K5) Help with sql statement to delete old records for user if multiple records found RE: Help with sql statement to delete old records for user if multiple records found
DAVNovak
Hall of Fame
Points: 3120
More actions
May 1, 2013 at 1:59 pm
#1611711
Or
delete a
FROM #UserSession a
WHERE EXISTS (SELECT NULL FROM #UserSession WHERE UserName = a.UserName AND LastUpdated > a.LastUpdated)