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 3983392
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:38:33+00:00 2026-05-20T05:38:33+00:00

ok, i will explain first what i have, and what i need as result.

  • 0

ok, i will explain first what i have, and what i need as result.

basicly, i have a phonebook, but the phonebook has duplicate records for “company”
while the duplicate records are not exactly duplicate… :\

i think an example will explain better:

demo records:

1. Company A, Address A, Phone A
2. Company A, Address A, Phone B
3. Company A, Address A, Phone C
4. Company A, Address B, Phone A

what i want, is to make a new table, which will be filled with all “Company A”, “Address A” phone numbers into one records, so the result should be something like:
Company A, Address A, Phone A, Phone B, Phone C etc..

The second problem is that “company A” can be also a bit diffrent, example:

 1. Company XYZ, Address A, Phone A

 2. Company ABC, Address A, Phone A

i dont even know how to start with this.
i was thinking of doing it by coding some c# application,
but i think there might be an easier solution by using pure mysql.

  • 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-05-20T05:38:33+00:00Added an answer on May 20, 2026 at 5:38 am

    Your way does not maintain normalization,
    however, the following might what you are looking for

    create new table:

    create table new_table
    (
      company_a varchar(255),
      address_a varchar(255),
      phone_a varchar(255),
      phone_b varchar(255),
      phone_c varchar(255)
    ); // define your index
    

    insert into new table:

    assuming phone does not contains ,

    insert into new_table
    select 
      company, 
      address, 
      substring_index(group_concat(phone), ',', 1) 
        as phone_a,
    
      substring_index(
        substring_index(group_concat(phone), ',', 2), ',', -1
      ) as phone_b,
    
      substring_index(group_concat(phone), ',', -1)
    from 
      old_table
    group by company, address;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will first explain why I need it, because I anticipate that the first
Not sure exactly how to explain this but Imaging you have a table with
First I will try to explain what I want to do. The app loads
The question is complicated but I will explain it in details. The goal is
The question might not be clear, so i will explain further. I saw some
Well, the subject says it all but I will explain a little further. I
I am trying to reduce some code here. I will explain how I have
I will try to explain this the best way I can, but feel free
First I will explain the context of the problem, because you might be able
I will explain more, because it might not be clear enough I want to

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.