If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > SQL Query Help Needed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-07, 10:59
stugautz stugautz is offline
Registered User
 
Join Date: Nov 2007
Posts: 1
Red face 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?
Reply With Quote
  #2 (permalink)  
Old 11-17-07, 13:31
prasan5984@gmail. prasan5984@gmail. is offline
Registered User
 
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 ....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On