使用ms访问的select语句替换空值

时间:2014-07-02 15:24:34

标签: sql ms-access-2007

SELECT A.CABLE_NO,A.LOC_A,A.LOC_B, iif(isnull(B.LENGTH,'SITE',B.LENGTH) AS CABLE_LENGTH
FROM TABLE_A AS A, TABLE_B AS B
WHERE A.id =B.id  

我想修改上面的代码,以便与MS Access / JET数据库引擎一起使用,

表A包含电缆号和位置a和位置b列,而表B包含长度,某些长度字段为空,即null, 我想在查询结果中将NULL值替换为SITE

1 个答案:

答案 0 :(得分:0)

SELECT A.CABLE_NO,A.LOC_A,A.LOC_B,
    ISNULL(B.LENGTH,'SITE') AS CABLE_LENGTH
FROM TABLE_A AS A, TABLE_B AS B
WHERE A.id =B.id