where 语句后面可以用 + - 吗?
大致如下结构:Select * from {Material_List} where StockQty + (子查询) + (子查询) + (子查询) - (子查询) <= QuantityAlert and (MaterialsClass = '外购件' or MaterialsClass = '标准件')
请问这样写是不是不正确?加上子查询就没结果了……研究半天了,还发现个问题,最后的or 一定要括弧括起来才生效居然!
实际查询语句如下:
Select * from {Material_List} where StockQty + (select sum(Quantity) from{Buy_List} where Material = {Material_List}.MaterialSpecification and Status <> '已请购') + (select sum(Quantity) from{Request_Orders} where Material = {Material_List}.MaterialSpecification and Status = '已请购') + (Select sum(Quantity) from {Purchase_Orders} where Material = {Material_List}.MaterialSpecification And IQCNumber In (Select IQCNumber from {IQC_List} where Status <> '已入库'or Status is NULL)) - (Select sum(Failure) from {Purchase_Orders} where Material = {Material_List}.MaterialSpecification And IQCNumber In (Select IQCNumber from {IQC_List} where Status <> '已入库'or Status is NULL)) <= QuantityAlert and (MaterialsClass = '外购件' or MaterialsClass = '标准件')