Monday, 31 October 2011

R12_PO_Query

/* Formatted on 27-08-2011 12:16:00 (QP5 v5.115.810.9015) */
  SELECT   DISTINCT poh.org_id,
                    hou.name,
                    poh.segment1,
                    TRUNC (poh.creation_date),
                    ood.organization_code
    FROM   po_headers_all poh,
           hr_operating_units hou,
           po_lines_all pol,
           po_line_locations_all pll,
           org_organization_definitions ood
   WHERE       poh.org_id = hou.organization_id
           AND poh.po_header_id = pol.po_header_id
           AND pll.po_header_id = poh.po_header_id
           AND pol.po_line_id = pll.po_line_id
           AND poh.org_id = pol.org_id
           AND ood.organization_id = pll.SHIP_TO_ORGANIZATION_ID
           AND TRUNC (poh.creation_date) BETWEEN '01-Apr-2011'
                                             AND  '31-jul-2011'
ORDER BY   poh.org_id, TO_NUMBER (poh.segment1), TRUNC (poh.creation_date)

No comments:

Post a Comment