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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:07:33+00:00 2026-05-17T02:07:33+00:00

I have a sql file which has a lot of insert statements (over 3000+).

  • 0

I have a sql file which has a lot of insert statements (over 3000+).
E.g.

insert into `pubs_for_client` (`ID`, `num`, `pub_name`, `pub_address`, `publ_tele`, `publ_fax`, `pub_email`, `publ_website`, `pub_vat`, `publ_last_year`, `titles_on_backlist`, `Personnel`) values('7','5','4TH xxxx xxxx','xxxx xxxx, 16 xxxxx xxxxx, xxxxxxx, We','111111111','1111111111','support@example.net','www.example.net','15 675 4238 14',NULL,NULL,'Jane Bloggs(Sales Contact:)jane.bloggs@example.net,Joe Bloggs(Other Contact:)joe.bloggs@example.net');

I have exported this into an excel document (I did this through running the query in phpmyadmin, and exporting for an excel document). There’s just one problem, as you can see in this case, there are two names & email addresses being inserted into ‘Personnel’.

How easy/difficult would it be to seperate these out to display as Name, email, Name2, email2?

  • 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-17T02:07:33+00:00Added an answer on May 17, 2026 at 2:07 am

    What about when there are three e-mails/names?
    With shown data it should be easy to do

    select replace(substring(substring_index(`Personnel`, ',', 1),length(substring_index(`Personnel`, ',', 1 - 1)) + 1), ',', '') personnel1,
           replace(substring(substring_index(`Personnel`, ',', 2),length(substring_index(`Personnel`, ',', 2 - 1)) + 1), ',', '') personnel2,
    from `pubs_for_client`
    

    The above will split the Personnel column on delimiter ,.
    You can then split these fields on delimiter ( and ) to split personnel into name, position and e-mail

    The SQL will be ugly (because mysql does not have split function), but it will get the job done.

    The split expression was taken from comments on mysql documentation (search for split).

    You can also

    CREATE FUNCTION strSplit(x varchar(255), delim varchar(12), pos int) returns varchar(255)
    return replace(substring(substring_index(x, delim, pos), length(substring_index(x, delim, pos - 1)) + 1), delim, '');
    

    After which you can user

    select strSplit(`Personnel`, ',', 1), strSplit(`Personnel`, ',', 2)
    from `pubs_for_client`
    

    You could also create your own function that will extract directly names and e-mails.

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

Sidebar

Related Questions

I have the following query in iSeries SQL which I output to a file.
Is there any way to have a Windows batch file directly input SQL statements
So I have an SQL dump file that needs to be loaded using mysql_query().
I've got two PostgreSQL databases that have been created using the same sql file.
I have a full MS SQL Backup file that I would like to extract
Is there a way to have an application access a SQL Compact database file
I'm looking for some clarity on the SQL Server log file. I have a
I have SQL query, which is working nice on Oracle and MSSQL. Now I'm
I have a table called Field in my SQL Server database. The table has
I have a LINQ to SQL class that I am reading into a List.

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.