我有一个名为CompApps的表,我希望根据多条件查询检索特定记录。我的SQL非常生疏,这就是我要求Stack Overflow的原因。我需要的是修改下面的SQL以包含一个where子句,它将在Interface,ExAPI,ExtraInfo,OpenCol等字段中排除没有任何相关信息的记录。也就是说,在下面的当前查询结果的图像中,我想要行170, 173, 174, 175, 177, 182, 185, 190
和NOT行,其中只有None,N \ A或接口,ExAPI,ExtraInfo,OpenCol
SELECT RefNum, Interface, ExAPI, ExtraInfo, OpenCol
FROM CompApps
答案 0 :(得分:3)
或者可能喜欢这个
根据dnoeth的评论对此进行更正:
SELECT RefNum, Interface, ExAPI, ExtraInfo, OpenCol
FROM CompApps
WHERE Interface NOT IN('None','N/A')
OR ExAPI NOT IN('None','N/A')
OR ExtraInfo NOT IN('None','N/A')
OR OpenCol NOT IN('None','N/A');
答案 1 :(得分:0)
where
(
(ISNULL(ExAPI, '') <> '' OR ExAPI <> 'N/A' OR ExAPI <> 'None')
OR
(ISNULL(ExtraInfo, '') <> '' OR ExtraInfo<> 'N/A' OR ExtraInfo<> 'None')
OR
(ISNULL(OpenCol, '') <> '' OR OpenCol<> 'N/A' OR OpenCol<> 'None')
)
答案 2 :(得分:0)
试试这个
SELECT RefNum, Interface, ExAPI, ExtraInfo, OpenCol
FROM CompApps
WHERE (Interface NOT IN ('','None','N/A'))
OR (ExAPI NOT IN ('','None','N/A'))
OR (ExtraInfo NOT IN ('','None','N/A'))
OR (OpenCol NOT IN ('','None','N/A'))