我的数据库字段像这样!USERS
userID username userpsd bumen sname
10001 12 123 IT 咨询
10002 34 123 NULL NULL
10003 56 123 NULL NULL
我现在想从SUERS表里查出BUMEN ,SNAME 两个字段
我用SELECT SNAME,bumen FROM Users
得到字段有
IT 咨询
NULL NULL
NULL NULL
但我现在只要
IT 咨询
我想把空的字段都不要,应该怎么写。
SELECT SNAME,bumen FROM Users
where sname is not null or
bumen is not null
SELECT SNAME,bumen FROM Users where SNAME IS NOT NULL OR bumen IS NOT NULL
SELECT SNAME,bumen FROM Users
where sname is not null and
bumen is not null