【发布时间】:2018-03-18 09:20:51
【问题描述】:
我有一个表“Cabine”,其中包含“SBC750”(整数)和“Evaso”(tinyint)字段
字段 Evaso 可以是 1、0 或 Null
我正在寻找 Evaso 不是 1 的所有 sbc750 的总和。
我试过了
select sum(sbc750) from cabine where evaso<>1;
但是结果是NULL:为什么???
如果我使用
select sum(sbc750) from cabine
我得到 55,如果我使用
select sum(sbc750) from cabine where evaso=1
我得到了 34 个!
所以结果可能是 21 而不是 Null。请帮帮我
【问题讨论】:
-
从机柜 WHERE evaso>1 OR evaso 中选择 SUM(sbc750) 怎么样
-
select sum(sbc750) from cabine where evaso IS NULL -
我同意 Sari .. 我有一种感觉,
<> 1你返回的结果为零.. 试试select * from cabine where evaso<>1;来测试这个理论.. -
是的 1 没有结果.. Sari 的建议不起作用。 lad2025 的一个。
标签: mysql