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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:00:58+00:00 2026-05-27T13:00:58+00:00

I have a table with the format ID NAME NICKNAME MENTOR_NAME MENTOR_NICKNAME ———————————————— 01

  • 0

I have a table with the format

ID NAME     NICKNAME MENTOR_NAME MENTOR_NICKNAME
------------------------------------------------
01 Nolan    Nole     Jonathan    Jones
02 Jonathan Jones 

The fields MENTOR_NAME and MENTOR_NICKNAME contain existing names (save for typos) of existing NAME and NICKNAME combinations.

To avoid the typo problem i want to replace MENTOR_NAME and MENTOR_NICKNAME with a MENTOR_ID resulting in a table like:

ID NAME     NICKNAME MENTOR_ID
------------------------------
01 Nolan    Nole     02
02 Jonathan Jonas

What i cant figure out is the query syntax so that i can avoid going through each record doing it by hand or having to write a php script just for this.

Can anyone help me with a query to make this transformation?

EDIT: Added example data.

  • 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-27T13:00:58+00:00Added an answer on May 27, 2026 at 1:00 pm

    This is to update existing table :-

    update the_table as a,
    the_table as b
    set a.mentor_id = b.mentor_id
    where a.name = b.mentor_name and a.nickname = b.mentor_nickname;
    

    If you want to copy into another table :-

    create table another_table
    select a.id, a.name, a.nickname, b.mentor_id
    from the_table as a
    inner join the_table as b
    on (a.name=b.mentor_name and a.nickname=b.mentor_nickname);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After doing some joins and stuff I have table in the following format name
I have a table named People in the following format: Date | Name .
I have a table that contains company names in this format: Name Name ,
I have user table having fields gender and first name like this.. The value
I have a SQLite database with this format: TABLE users | |---------name - text
I have a table name Data with fields Surmane , Name , Timestamp ,
I have table named collections in which there are fields pk_collectionid and name .
I have a table in this format. <table> <tr> <td id=divOne>div one</td> <td id=divOne>2222</td>
I want to display a ListView in table format. The ListView should have rows
I have a table in sql where the date format is stored in Hijri.

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.