example mysql query to update a table

[expired user #8567]'s profile image [expired user #8567] posted 9 years ago in General Permalink
Can anyone come up with a query to do this:

Table1 contains uk postcodes (the key field), counties and towns - approx 2m recs - in the following formats:
AB11 2AB, B23 1AD, B1 3AR, etc.

Table2 is a much smaller one containing the same data except that the postcode/key field only has the first part of the postcode - before the space.

I need to update all records in Table1 with the town and county data from Table2, where the part of the key, before the space, equals the key of Table2

Please login to leave a reply, or register at first.