SQL script

Posted on 2011-05-08
Last Modified: 2012-05-11
Hi. Have a table that contains account information such as name, address, email, telephone number, etc.

Need syntax to return any persons name that have the same telephone number listed more than x times. So, when the query is executed, it will only look for telephone numbers that have been listed more than x times and will return the persons name and address.

Thanks in advance.
Question by:B0b_shiska
    LVL 57

    Accepted Solution

    Here you go:

    select name, address
    FROM ur_table
    WHERE phone_no in (
    Select telephone_no
    FROM ur_table
    Group by telephone_no
    having COUNT(*) > 1)
    LVL 21

    Expert Comment

    by:Alpesh Patel
    select name, phone_no, Count(phone_no) FROM table
    Group by name
    having COUNT(phone_no) > 1)
    LVL 19

    Expert Comment

    by:Bhavesh Shah

    Rajan Sir already gave you answer, but just for your knowledge

    SELECT  name, address, email, phone_no
    FROM table1 A,(Select name from table1 group by name having count(phone_no)>1) B
    WHERE =

    - Bhavesh
    LVL 8

    Expert Comment

    Try this

    LVL 30

    Expert Comment

    I go with PatelAlpesh's comment, but insert x in place of 1, from a form field. This allows for different x values.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
    How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now