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
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!)
SELECT column,COUNT(*) c FROM table GROUP BY column HAVING COUNT(*) > 1
You need to create an account or log in to post comments to this site.
» Randomly ordered results in ... in sql tsql
» Dynamic ordering without dyn... in sql tsql
» Retrieve MSSQL table informa... in sql server tsql mssql table microsoft column information properties sysproperties systables data type types length columns
» Scripting schema updates in ... in sql tsql database mssql schema update tables microsoft columns query scripting information_schema alter altering
» iSQL sucks, so make it work ... in sql unix linux tsql language query transact structured odbc isql unixodbc
» A query from ActiveRecord th... in sql activerecord
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails