我有一个这样的查询:
SELECT distinct [F_Exhibitor_Name],
F_Site
FROM [V_ExhibitorLocation]
WHERE F_ExhibitionCode ='10996' is not null
ORDER BY F_Exhibitor_Name
但显示错误
Incorrect syntax near the keyword 'is'
.
最佳答案
您必须删除is not null
,如下所示
SELECT distinct [F_Exhibitor_Name],F_Site
FROM [V_ExhibitorLocation]
Where F_ExhibitionCode ='10996'
order by F_Exhibitor_Name
或使用不能为空的字段添加条件,如下所示
SELECT distinct [F_Exhibitor_Name],F_Site
FROM [V_ExhibitorLocation]
Where F_ExhibitionCode ='10996'
and [column] is not null
order by F_Exhibitor_Name
关于sql - 从查询中排除 NULL 时收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30217861/