Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:07:24+00:00 2026-06-06T03:07:24+00:00

I need to query statistics about duplicate values in my database table. For example,

  • 0

I need to query statistics about duplicate values in my database table. For example, say that I have an e-mail field and multiple rows can have the same e-mail. I know want to know is how many addresses is repeated how many times. In other words: “908 emails are repeated 10 times, 1783 emails are repeated 9 times” and so on.

Repeated       # of Emails
10             908
9              1783

I don’t need to see the actual e-mail addresses, just these statistics.

Right know I have this query which also retrieves the e-mail address:

select email_address,
count(email_address) as NumberOccurrences
from table_user_info
group by email_address
having ( count(email_address) > 1 )

How do I group these results?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:07:25+00:00Added an answer on June 6, 2026 at 3:07 am

    An aggregate COUNT() with a subquery also returning an aggregate COUNT() will provide this. The subquery groups and counts per email address, as in abc@example.com - 10, and the outer query then counts and groups by the number of repeats returned by the subquery, discarding the actual email addresses.

    SELECT
      repeated,
      COUNT(*) AS numemails
    FROM (
      SELECT 
         email,
         COUNT(*)
      FROM emails
      GROUP BY email
    ) emailcounts
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have only 1 column. I need statistics about it's values and their usage:
I need a query which can do the following operation. I have a table
I need a query that will return a table where each column is the
I have the following database table with information about people, diseases, and drugs: PERSON_T
Say I have a voting table, where users can vote on values up, down,
Back story i have a table that stores cached times, and currently has about
i need to write a query that print a daily statistics of calls. my
need some your help with a query. I have a table Managers (ManagerId, ManagerName)
I need to be able to query a PostgreSQL database to obtain information about
do you know when you have that huge log table and you just need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.