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

  • Home
  • SEARCH
  • 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 8437929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:34:06+00:00 2026-06-10T07:34:06+00:00

I have two tables. customer table It has 3 fields.. customer_id first_name last_name customer

  • 0

I have two tables.

customer table

It has 3 fields..

  1. customer_id
  2. first_name
  3. last_name

customer address table

It has 2 fields

  1. customer_id
  2. address

My problem is my customer table has 259 rows where as my customer address table has 400+ rows.
I mean my customer address table contains duplicate rows.

Now i would like select only unique rows from my customer address table…

Can anyone help me?

Thanks

  • 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-10T07:34:08+00:00Added an answer on June 10, 2026 at 7:34 am

    In the event that the customer_id and address are the same for each duplicate, you could use DISTINCT:

    SELECT DISTINCT(`customer_id`), `address` FROM `customer_addresses`;
    

    If a customer has two different addresses in the table, you will receive two results with the above query. To get a single result per customer, you can use GROUP BY:

    SELECT `customer_id`, `address` FROM `customer_addresses` GROUP BY `customer_id`;
    

    This will be guaranteed to return a single result per-customer.

    To build upon the use of GROUP BY, you can also use it to find the customers with duplicate entries:

    SELECT `customer_id` FROM `customer_addresses` GROUP BY `customer_id` HAVING COUNT(*) > 1;
    

    This will return only the customer’s that have duplicate entries (i.e. – a count of >1) in the customer_addresses table – which may help you resolve your duplicate problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, Customer and CustomerPhone. Customer usually has multiple phone numbers, so
Suppose that I have two Hibernate POJOs: Customer and Order. The Order table has
I have two tables, one called Events and one called Documents. Each table has
I have two tables Profile_Appointments and Profile. Each record in the profile table has
I have the following two tables: Customer { int Id int Name } Bills
I have two tables in my database that look like that: Customer: C_ID city
I have two tables, one with products and a foreign key for the customer.
I have two tables: table a ida valuea 1 a 2 b 3 c
I have two tables one with ID and NAME table 1 ID | NAME
Suppose I have two SQL tables: Customers and PhoneNumbers. Suppose that Customers has the

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.