如何从输出中删除0个值行

时间:2019-05-08 07:31:06

标签: sql

我只需要考虑p个pty不为零的行

在有条件的情况下,我尝试了[P Qty] <> 0和[P Qty]!= 0,但没有用

select ile.[Document No_],ile.[Source No_],ile.[Posting Date],
sum(ile.Quantity) as [P Qty],

sum([Cost Amount (Actual)]) as [P Cost]
from [X Limited$Item Ledger Entry] ile
left join [X Limited$Value Entry] ve
on ile.[Entry No_] = ve.[Item Ledger Entry No_] 
left join [X$Item] i
on i.No_ = ile.[Item No_]
left join 
 [X$Location] on ile.[Location Code]= [X$Location].[Code] 

where  ile.[Posting Date] between '2019-03-01' and '2019-03-31' and ile.[Order Type] =1 and ile.[Document No_]='RPOS/1819/03/1059' 
and ile.[Entry Type] =6 and  [X$Location].[Production Location]= 1 and ile.[Quantity]<>0

group by ile.[Document No_],ile.[Source No_],ile.[Posting Date]


) as P
on  P.[Document No_] = C.[Document No_] and P.[P Qty]!=0 
where P.[Document No_]='RPOS/1819/03/1059' and P.[P Qty] <> 0

1 个答案:

答案 0 :(得分:0)

您可以在where子句之后有HAVING子句

HAVING [P Qty] != 0;