抱歉,如果这是一个愚蠢的问题,但我无法理解这一点。如果存在,我只想选择一个带有冒号的值,这个值是“县”。但是,我不确定我是否以正确的方式进行此操作?任何帮助将不胜感激。
SELECT pe.personname AS "Person Name", pe.street||','||pe.town||','||
IF NOT EXISTS(SELECT pe.county FROM persons pe WHERE pe.county = '')
THEN pe.county||','||
ELSE
END IF
pe.postcode as "Persons Address"
FROM persons pe
如果没有县,更新版本会输出多个逗号。
SELECT personname as "Person Name"
street||','||town||
CASE county
WHEN '' THEN ''
ELSE ','||county
END
||','||postcode as "Person Address"
from Suppliers;