博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Debit form 与SO不一致的查询

Posted on 2012-05-29 16:36  奥客  阅读(169)  评论(0编辑  收藏  举报

 

select a.*,b.*
from(
select t1.line_id,abs(sum(t1.quantity)) db_so,abs(t2.ordered_quantity) od_so from SECOM_SOPO_MATCHES t1,ont.oe_order_lines_all t2
where t1.line_id=t2.line_id
--and t1.line_id=466338
group by t1.line_id,t2.ordered_quantity
having abs(sum(t1.quantity))<>abs(t2.ordered_quantity)
) a
,(


select ol.line_id, oh.order_number, ol.ordered_item ,ol.creation_date
from oe_order_lines_all ol
,oe_order_headers_all oh
where ol.header_id=oh.header_id
) b
where a.line_id=b.line_id