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');