find duplicates
SELECT column,COUNT(*) c FROM table GROUP BY column HAVING COUNT(*) > 1
results show the column value and the number of duplicates for that value
2591 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
rednuht http://www.jumpstation.co.uk
SELECT column,COUNT(*) c FROM table GROUP BY column HAVING COUNT(*) > 1
DECLARE @order int SET @order = 1 SELECT * FROM users ORDER BY CASE WHEN @order = 1 THEN [name] END DESC, CASE WHEN @order = 2 THEN [name] END ASC, CASE WHEN @order = 3 THEN [email] END DESC, CASE WHEN @order = 4 THEN [email] END ASC
SELECT TOP 10 userID FROM user ORDER BY NEWID()
SELECT TOP 10 NEWID() [egg], userID FROM user ORDER BY [egg]
SELECT TOP 10 NEWID(), userID FROM user ORDER BY 1
UPDATE emailFormat SET format=2 FROM emailFormat EF INNER JOIN user U ON EF.userID = U.userID