In a single point update, you use update t1 set c1=x where y .
In an update with multiple tables, you use update t1, t2 set t1.c1=t2.c2 where t1.c3=t2.c4
Here's the relevant documentation http://dev.mysql.com/doc/refman/5.0/en/update.html
What you are looking for is something like the lines (edited) update logs.logs as l, ipinfo.ip_group_country as c set l.COUNTRY_CODE=c.country_code where c.ip_start <= INET_ATON(l.REMOTE_ADDR) order by c.ip_start asc
Edit: you're right, max () in the original answer that I provided could not work. The above request should, although it is likely to be less efficient than something like the approach in the answer below.
nicolaskruchten
source share