当我使用此查询时:
SELECT * from table
也会显示空结果。
当我使用时:
SELECT * from table WHERE tablet<>''
我得到了我想要达到的结果,但仅用于tablet
。我想为整个表格实现这个目标。
类似的东西:
SELECT * from table //that is not empty
有什么想法吗?谢谢!
答案 0 :(得分:2)
我认为您正在寻找包含2列的单个列表:
SELECT `Handy` AS Category,
T.Handy AS Description
FROM Table AS T
WHERE T.Handy <> ''
UNION ALL
SELECT `PC` AS Category,
T.PC AS Description
FROM Table AS T
WHERE T.PC <> ''
UNION ALL
SELECT `Notebook` AS Category,
T.Notebook AS Description
FROM Table AS T
WHERE T.Notebook <> ''
UNION ALL
SELECT `Tablet` AS Category,
T.Tablet AS Description
FROM Table AS T
WHERE T.Tablet <> ''
ORDER BY Category
答案 1 :(得分:0)
执行此操作的唯一方法是对每个字段使用and
语句
SELECT * from table WHERE tablet<>'' AND handy<>'' AND pc<>''
(抱歉,我的工作阻止了imgr.com,所以我看不到你的截图,也不知道你桌子上的所有栏目。)
答案 2 :(得分:0)
您可以使用一堆!= ''
条件:
SELECT *
FROM table
WHERE handy != '' AND
pc != '' AND
notebook != '' AND
tablet != ''
答案 3 :(得分:0)