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.
This is to update existing table :-
If you want to copy into another table :-