Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sub-select in oracle

Rahul KhannaSep 7 2016 — edited Sep 7 2016

I'm trying to select the newest price from another table in a sub select. But I can't figure out how to get it working.

This is what I've tried:

select something, somthingelse,
 
(
  
select * from
  
(
  
select QUOTE_PRICE as old_price
  
from price_history
  
where price_history.part_no= article_table.part_no
  
order by valid_from desc
  
) where rownum=1
 
)
from  article_table where rownum < 5

The subselect works by itself, but it can't find article_table.part_no:

SQL Error: ORA-00904: "article_table "."part_no": invalid identifier

This post has been answered by Poor-Boy on Sep 7 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2016
Added on Sep 7 2016
6 comments
369 views