为什么我收到错误代码1066.此sql脚本上没有唯一的表/别名UPDATE `20160318 flagdatabase`,
`usps 75078`
INNER JOIN `usps 75078` ON `20160318 flagdatabase.Street` = `usps 75078.Street_Name`
SET `20160318 flagdatabase.Carrier_Route` = `usps 75078.Carrier_Route`
SET `20160318 flagdatabase.Zip4_Low_Add` = `usps 75078.Zip4_Low_Add`
SET `20160318 flagdatabase.Zip4_High_Add` = `usps 75078.Zip4_High_Address`
WHERE `20160318 flagdatabase.Street` = `usps 75078.Street_Name`
AND `20160318 flagdatabase.HouseNumber` >= `usps 75078.Primary_Low_Address`
AND `20160318 flagdatabase.HouseNumber` <= `usps 75078.Primary_High_Address`;
:
<application
android:name=".LoginManager"
android:theme="@style/AppTheme">
答案 0 :(得分:1)
由于表名中的(疯狂)使用点和空格,您的查询很难阅读,因此我将使用占位符名称来解释。
您的查询如下:
update t1, t2 join t2 on some condition
...
在查询中列出了两次t2。您必须给(至少)其中一个t2引用别名,并在整个查询中使用该别名而不是表名,如下所示:
update t1, t2 join t2 as t3 on some condition
...
我已经使用了&#34; t3&#34;作为别名。
答案 1 :(得分:0)
我认为你需要修复你的查询,并保持这样:
UPDATE `20160318 flagdatabase`,
INNER JOIN `usps 75078` ON `20160318 flagdatabase.Street` = `usps 75078.Street_Name`
SET `20160318 flagdatabase.Carrier_Route` = `usps 75078.Carrier_Route`,
`20160318 flagdatabase.Zip4_Low_Add` = `usps 75078.Zip4_Low_Add`.
`20160318 flagdatabase.Zip4_High_Add` = `usps 75078.Zip4_High_Address`
WHERE `20160318 flagdatabase.Street` = `usps 75078.Street_Name`
AND `20160318 flagdatabase.HouseNumber` >= `usps 75078.Primary_Low_Address`
AND `20160318 flagdatabase.HouseNumber` <= `usps 75078.Primary_High_Address`;