MySQL update based upon postal code -


i have usertable includes field named zip (postal code) have geo table latitude, longitude values, based upon zipcodes.

so:

usertable  table_1 contains fields: zip, latitude,longitude (in last 2 fields values null) geotable: table_2 contains fields: zip, latitude,longitude 

the zipcode in table_1 has format: 1111 aa (4 numbers, 2 letters, split empty character)

the zipcode in table_2 has format: 1111 (only 4 numbers)

i trying find out how update query should like?

i want update usertable values geotable, search query can done without joins. search queries used queries on site, updates/checks seldom.

thanks in advance help!

you write

update table_1 set   latitude = (select latitude table_2 table_1.zip concat(table_2.zip, '%')),   longitude = (select longitude table_2 table_1.zip concat(table_2.zip, '%')); 

unfortunately don't believe there syntax quite similar colin suggesting. may find more efficient select values table_2 first , insert them.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -