Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 11: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, 14: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

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