Skip to content

Instantly share code, notes, and snippets.

@andresmoschini
Created January 20, 2012 13:52
Show Gist options
  • Save andresmoschini/1647466 to your computer and use it in GitHub Desktop.
Save andresmoschini/1647466 to your computer and use it in GitHub Desktop.
Which is the least ugly?
DELETE q FROM (
SELECT TOP 1000000 *
FROM sc_logging
WHERE DATEDIFF(day, Date, CURRENT_TIMESTAMP) > 15
ORDER BY Date ASC) q
DELETE FROM sc_logging
WHERE Id IN (
SELECT TOP 1000000 Id
FROM sc_logging
WHERE DATEDIFF(day, Date, CURRENT_TIMESTAMP) > 15
ORDER BY Date ASC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment