Connecting Tech Pros Worldwide Help | Site Map

oracle sub query issue

  #1  
Old May 21st, 2009, 05:53 AM
Member
 
Join Date: Oct 2008
Location: India Bangalore
Posts: 37
Hi,
I am working on a project in JSP with Oracle 10G
I have a query like:
select max(item_id) itemid from item_table
in this i am getting the latest id no and the same is being displaying it back to the user.

If i want to fetch another column (suppose item_expire_date ) from same table for the max(item_id) how is it possible ?

Finally user should get his id no as well as item_expire_date for the item he has posted.

Kindly help me out please
Eagerly awaiting for response
With Thanks in advance

Naveen
  #2  
Old May 21st, 2009, 11:42 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,485
Provided Answers: 1

re: oracle sub query issue


You need to use GROUP BY clause in the query .
  #3  
Old June 3rd, 2009, 08:23 PM
Newbie
 
Join Date: Dec 2008
Posts: 9

re: oracle sub query issue


use this query :
Quote:
select item_id , item_expire_date
from item_table
where
item_id = (select max(item_id) from item_table )
hope this helps ..
  #4  
Old June 4th, 2009, 06:54 AM
Member
 
Join Date: Oct 2008
Location: India Bangalore
Posts: 37

re: oracle sub query issue


Hi,
Many Thankx for your idea.My problem i solved.
Regards
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
query issue curwen answers 9 June 27th, 2008 06:53 PM
Access as Frontend to Oracle questions - Memo-to-CLOB? View vs. Query? jonceramic answers 5 February 3rd, 2007 02:05 AM
ASP Aggregate Function Aaron answers 3 December 15th, 2006 06:15 PM
Convert MS Access DB (FE&BE) to Oracle egoldthwait@westernasset.com answers 2 March 2nd, 2006 12:05 AM