0
我需要一个查询,我可以从qty手中获取结果,分配数量和数量有序。在我的查询中完成想要的结果的想法
我的问题是,我有这个查询,它并没有显示我手头上的数量等于0,其他2列中的任何值。
select
item_location_view.qty_on_hand AS 'Qty on Hand',
item_location_view.qty_allocated AS 'Qty Allocated',
item_location_view.qty_backordered AS 'Qty Backordered'
FROM
dbo.inv_mast inv_mast,
dbo.item_location_view item_location_view
WHERE
inv_mast.item_id = item_location_view.item_id AND
((item_location_view.qty_on_hand>=0) AND
(item_location_view.qty_allocated>0) AND
(item_location_view.qty_backordered>0))
谢谢大家
首先不使用旧加入notation.Promote使用显式的'JOIN' sintaxis,Aaron Bertrand写了一篇不错的文章[踢坏坏习惯:使用o ld-style JOINs](http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old-style-joins.aspx)。 –
只要符合其他2个条件,您就应该得到结果,因为您的所有条件都与“AND”关联。你是否至少有一行OnHand = 0,Alloc> 0,以及延期> 0?如果没有,你不会看到任何结果。尝试评论你的Alloc和缺货情况,看看你是否得到你期望的结果。 – Beth