mySQL - changing field contents to enumerated indices

I have a Domain Name Table  field that is TLD and contains the TLD  text
com
net
org
info

etc.

I have a new table that contains all the TLDs that we use, as indexed by a contiguous index.
1 com
2 org
3 net
etc

is there an easy way WITHIN a SQL statement to match  com  and replace with 1
(or i'm fine to do an intermediary table that will collect the results and then rename the table name accordingly)
willsherwoodAsked:
Who is Participating?
 
theGhost_k8Connect With a Mentor Database ConsultantCommented:

Update tld_txt T1, tld T2 set T1.FieldName=T2.id where T1.FieldName=T2.FieldName;

0
 
willsherwoodAuthor Commented:
ooo that's easy.   thank you!!!
0
 
willsherwoodAuthor Commented:
elegant!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.