Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Red face Unanswered: SQL Query Help Needed

    I am having problems writing a query.

    My query is

    Code:
    SELECT
        V_MSTR_PO.CUST_PART,
        V_MSTR_PO_PART_PRICE.PRICE_PER_UNIT,
        V_MSTR_PO_PART_PRICE.PRICE_EFF_DATE,
        V_MSTR_PO.CURR_CODE,
        V_MSTR_PO.MULT_RATE_FUNC
    FROM
        V_MSTR_PO,
        V_MSTR_PO_PART_PRICE
    WHERE
        V_MSTR_PO_PART_PRICE.KEY_ID = V_MSTR_PO.KEY_ID
    But I only want to pull in the latest PRICE_PER_UNIT. I know I need to do a subquery and return the max PRICE_EFF_DATE but I can't figure out how to do it. Can somebody please help me?

  2. #2
    Join Date
    Nov 2007
    Posts
    2
    Try This Out

    Select
    V_mstr_po.cust_part,
    V_mstr_po_part_price.price_per_unit,
    V_mstr_po_part_price.price_eff_date,
    V_mstr_po.curr_code,
    V_mstr_po.mult_rate_func
    From
    V_mstr_po,
    V_mstr_po_part_price
    Where
    V_mstr_po_part_price.key_id = V_mstr_po.key_id
    And
    V_mstr_po_part_price.price_eff_date = (select Max(price_eff_date) From V_mstr_po_part_price);



    I Dint Try It Out....
    Pls Let If It Worked Or Not ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •