【发布时间】:2013-08-24 15:19:45
【问题描述】:
我有一个视图,我想用一个词更改列中的空值:other。
这是我迄今为止尝试过的:
CREATE VIEW APB1 AS
SELECT jos_jam.postcode, location_id, description,
category, apb.street, location, apb
FROM jos_jam
LEFT JOIN apb
ON jos_jam.postcode=apb.postcode;
FROM apb
UPDATE APB1 SET apb = 'Other' where apb is null
那没有正确替换值,我也试过了:
CREATE VIEW APB1 AS
SELECT jos_jam.postcode, location_id, description,
category, apb.street, location, apb
FROM jos_jam
LEFT JOIN apb
ON jos_jam.postcode=apb.postcode;
REPLACE(apb.apb, 'NULL') as 'Other'
FROM apb
第二个查询出现以下错误:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'FROM apb
UPDATE APBVolunteers4 SET apb = 'Other' where apb is null' at line 1
这个错误是什么意思,如何在视图中用单词替换空值?
【问题讨论】:
标签: mysql string view replace null