Timezones
---------
-AreaCode varchar
-Timezone varchar
Contacts
--------
-Phone    varchar
-Timezone varchar
除了联系人表中的所有内容都已填充Timezone,因此我想查找每个电话号码的时区并更新联系人。这是我试图做的,但MySQL给了
错误 1242 子查询返回多于一行
对于每个时区(0、-1、-2、-3、-4、-5),我执行以下更新:
update contacts 
set contacts.timezone = '-1' 
where left(contacts.phone,3) = (Select timezones.areacode 
                                from timezones 
                                where timezones.timezone = '-1');