select o.orgName, oc.dupeCount, o.id
from organizations o
inner join (
SELECT orgName, COUNT(*) AS dupeCount
FROM organizations
GROUP BY orgName
HAVING COUNT(*) > 1
) oc on o.orgName = oc.orgName
More Related Contents:
- How do I find duplicates across multiple columns?
- Removing duplicate rows (based on values from multiple columns) from SQL table
- Max sal to print base on manager_id
- Creating stored procedure getting Incorrect syntax near the keyword ‘Declare’
- Can I use CASE statement in a JOIN condition?
- sql server 2008 management studio not checking the syntax of my query
- Conversion failed when converting date and/or time from character string while inserting datetime
- Create a date from day month and year with T-SQL
- How should I pass a table name into a stored proc?
- Get the last inserted row ID (with SQL statement) [duplicate]
- Get the week start date and week end date from week number
- Parse comma-separated string to make IN List of strings in the Where clause
- conditional unique constraint
- Run all SQL files in a directory
- Transfer data from one database to another database
- Sequence vs identity
- How to update and order by using ms sql
- Using Excel VBA to run SQL query
- Reference an alias elsewhere in the SELECT list
- The backend version is not supported to design database diagrams or tables
- Split string and take last element
- Can I set ignore_dup_key on for a primary key?
- Selecting first row per group
- How do I specify date literal when writing SQL query from SQL Server that is linked to Oracle?
- How do I add a auto_increment primary key in SQL Server database?
- SQL Row_Number() function in Where Clause
- Cumulative Total in MS Sql server [duplicate]
- What does ON [PRIMARY] mean?
- Export table data from one SQL Server to another
- Getting warning: Null value is eliminated by an aggregate or other SET operation