select (round(
(isnull(sum(OD1.AfterDiscount),0)
+ isnull((select sum(td.freight) from K_FS_GenerateDcno TD where TD.Name =32),0)
- isnull((select sum(recamount) from K_FS_AmountReceived AR where AR.Name=32),0)
)>500000,0))
from K_FS_OrderDetails OD
left outer join K_FS_OrderDetails1 OD1 on OD1.ID=OD.sno
left outer join K_FS_DistributorDetails DD on DD.sno = OD.customername
where OD.confirmation='True' and OD.customername=32
我在>时遇到错误500000条件......
请帮帮我
答案 0 :(得分:1)
请改为尝试:
Select a.*
From (
select round(
(
isnull(sum(OD1.AfterDiscount),0)+
isnull((select sum(td.freight) from K_FS_GenerateDcno TD where TD.Name =32),0) -
isnull((select sum(recamount) from K_FS_AmountReceived AR where AR.Name=32),0)
),0) as RoundedAmount
from K_FS_OrderDetails OD
left outer join K_FS_OrderDetails1 OD1 on OD1.ID=OD.sno
left outer join K_FS_DistributorDetails DD on DD.sno = OD.customername
where OD.confirmation='True' and OD.customername=32
) as a
Where RoundedAmount > 500000
这将在计算后评估RoundedAmount
。
答案 1 :(得分:0)
某些括号错误,但没有信息您想要对查询做什么。
选择部分的简化结构是:
(round( (isnull()+isnull()-isnull()) > 50000,0))
所以你要舍入一个布尔值?!