Jump to content

Join two tables on a similar field


grippat

Recommended Posts

I'm trying to figure out how to join two MySQL tables on a similar field in an update. I have one table "Companies" and another "Territories" that don't share an identical field, however they both have zip code fields. The one in Companies is 5 digits plus 4 like 12345-1234 and the one in Territories is just 5 digits like 12345. Is there a way I can do this? Would I be able to do something like this:

UPDATE Companies coJOIN Territories trON tr.zipcode LIKE co.zip SET co cust_sales_rep = tr.sales_rep_id

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...