This is significantly faster than the EXISTS
way:
SELECT [EmailAddress], [CustomerName] FROM [Customers] WHERE [EmailAddress] IN
(SELECT [EmailAddress] FROM [Customers] GROUP BY [EmailAddress] HAVING COUNT(*) > 1)
More Related Contents:
- How to delete 0 values but not blanks from a column in SQL Server 2008 programming?
- Efficiently convert rows to columns in sql server
- How can I get column names from a table in SQL Server?
- Is there a way to access the “previous row” value in a SELECT statement?
- What this query does to create comma delimited list SQL Server?
- SQL Server – Return value after INSERT
- How can I select the first day of a month in SQL?
- SQL NVARCHAR and VARCHAR Limits
- Select statement to find duplicates on certain fields
- T-SQL datetime rounded to nearest minute and nearest hours with using functions
- SQL Server : dynamic pivot over 5 columns
- How to select the last record of a table in SQL?
- Using a Variable in OPENROWSET Query
- How to find current transaction level?
- How to create table using select query in SQL Server?
- Check for file exists or not in sql server?
- Group DateTime into 5,15,30 and 60 minute intervals
- Is there a SELECT … INTO OUTFILE equivalent in SQL Server Management Studio?
- SQL SERVER: Get total days between two dates
- Store multiple bit values in a single table column
- SQL Server equivalent to MySQL enum data type?
- UPDATE and REPLACE part of a string
- Improve SQL Server query performance on large tables
- Using IF ELSE statement based on Count to execute different Insert statements
- How to execute a stored procedure inside a select query
- Using CASE Statement inside IN Clause
- Single or multiple databases
- SQL Unpivot multiple columns Data
- How to do a case sensitive GROUP BY?
- How to automatically generate unique id in SQL like UID12345678?