结构表在这里显示
如果我使用查询:
select idn
from balans as outerB WHERE idn!='' group by idn order by
ifnull((select sum(innerB.amount) from balans as innerB
where innerB.idn = outerB.idn
and status='up'), 0) -
ifnull((select sum(innerB.amount) from balans as innerB
where innerB.idn = outerB.idn
and status='down'), 0) desc
limit 15
我得到2行。
但是如果我添加条件>0
:
select idn from Balans as outerB WHERE idn!='' AND
(
(select sum(innerB.amount) from Balans as innerB
where innerB.idn = outerB.idn
and type='up') -
(select sum(innerB.amount) from Balans as innerB
where innerB.idn = outerB.idn
and type='down')
) > 0
group by idn order by
ifnull((select sum(innerB.amount) from Balans as innerB
where innerB.idn = outerB.idn
and type='up'), 0) -
ifnull((select sum(innerB.amount) from Balans as innerB
where innerB.idn = outerB.idn
and type='down'), 0) DESC
limit 15
结果我得到0行......
请告诉我哪里出错了?为什么我得到 0 行?