update a inner join (SELECT * FROM b) on a.iplong >=b.ip1 and a.iplong < b.ip2
set a.country = b.country, a.city = b.city ;
http://dev.mysql.com/doc/refman/5.6/en/update.html
这称为: Multiple-table syntax:
UPDATE [LOW_PRIORITY] [IGNORE] table_references
SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
[WHERE where_condition]
table_references的定义在这里:
http://dev.mysql.com/doc/refman/5.6/en/join.html
PS, 这个sql应该是错的. mysql里应该会报:
ERROR 1248 (42000): Every derived table must have its own alias