grippat Posted October 3, 2007 Report Share Posted October 3, 2007 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 More sharing options...
justsomeguy Posted October 3, 2007 Report Share Posted October 3, 2007 No, you can't use a join in an UPDATE statement. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now