SQL Script:
SELECT a.segment1 po_num
,a.creation_date ordercreation_date
,b.item_description
,c.need_by_date
,a.type_lookup_code
,g.quantity
,g.line_rev
,g.header_rev
FROM po_headers_all a
,po_lines_all b
,po_line_locations_all c
,po_line_locations_archive_all f
,(SELECT DISTINCT e.segment1
,f.quantity
,f.revision_num line_rev
,e.revision_num header_rev
,e.last_update_date
,LOCATION(e.bill_to_location_id) LOCATION
,e.po_header_id
FROM po_headers_archive_all e
,po_line_locations_archive_all f
WHERE e.po_header_id = f.po_header_id(+)
AND f.revision_num(+) = e.revision_num
AND TRUNC(e.last_update_date) =
TO_DATE('5/11/2011', 'mm/dd/yyyy')
ORDER BY e.revision_num
,f.revision_num) g
WHERE a.po_header_id = b.po_header_id
AND b.po_line_id = c.po_line_id
AND a.po_header_id = g.po_header_id
No comments:
Post a Comment