我收到错误
语法错误在或附近"其中"第5行:拉链进入(选择邮政编码 来自拉链的城市='萨克拉
当我尝试运行此代码时。
update listings
set price = CASE WHEN (listings.price IS NOT NULL) THEN (price *
(((100+(select price_change from zips where zips.zipcode=listings.zip))/100)))
where zip in (select zipcode from zips where city = 'Sacramento');
有人看到任何容易修复的错误吗?还是我想出了一些垃圾代码?
答案 0 :(得分:1)
SQL CASE
expression需要以END
关键字结束。
答案 1 :(得分:0)
update listings
set price = CASE WHEN (listings.price IS NOT NULL) THEN (price *
(((100+(select price_change from zips where zips.zipcode=listings.zip))/100)))
where zip in (select zipcode from zips where city = 'Sacramento')
删除;再试一次
答案 2 :(得分:0)
在 where 子句
之前添加结束关键字update listings
set price = CASE WHEN (listings.price IS NOT NULL) THEN (price *
(((100+(select price_change from zips where zips.zipcode=listings.zip))/100))) END
where zip in (select zipcode from zips where city = 'Sacramento');
根据@ a_horse_with_no_name的评论
update listings
set price = (price * (((100+(select price_change from zips where zips.zipcode=listings.zip))/100)))
where zip in (select zipcode from zips where city = 'Sacramento') and listings.price IS NOT NULL