December 19, 2012 at 1:15 pm
I have a query that returns a duplicate account listing:
SELECT Account
FROM Account_Table
WHERE Account IN
(
SELECT Account
FROM Account_Table
GROUP BY Account
HAVING COUNT(*) > 1
)
It returns the results I want listed with the duplicate accounts.
What I would like to find out now is the total number of accounts that have duplicates.
For example...if my query above returns the results below:
Account
101
101
102
102
102
103
103
It displays results of 7 rows affected.
But I want it to display a total count of 3 duplicate accounts.
Is that possible?
Thanks for any help!
December 19, 2012 at 1:21 pm
jillk (12/19/2012)
I have a query that returns a duplicate account listing:SELECT Account
FROM Account_Table
WHERE Account IN
(
SELECT Account
FROM Account_Table
GROUP BY Account
HAVING COUNT(*) > 1
)
It returns the results I want listed with the duplicate accounts.
What I would like to find out now is the total number of accounts that have duplicates.
For example...if my query above returns the results below:
Account
101
101
102
102
102
103
103
It displays results of 7 rows affected.
But I want it to display a total count of 3 duplicate accounts.
Is that possible?
Thanks for any help!
SELECT
Account_Table.Account,
COUNT(1)
FROM
Account_Table
GROUP BY
Account
HAVING
COUNT(1) > 1;
Roland Alexander
The Monday Morning DBA
There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer
December 19, 2012 at 1:37 pm
Thank you!
December 19, 2012 at 2:05 pm
🙂
Roland Alexander
The Monday Morning DBA
There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply