Connecting Tech Pros Worldwide Help | Site Map

oracle sub query issue

Member
 
Join Date: Oct 2008
Location: India Bangalore
Posts: 37
#1: May 21 '09
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
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,497
#2: May 21 '09

re: oracle sub query issue


You need to use GROUP BY clause in the query .
Newbie
 
Join Date: Dec 2008
Posts: 9
#3: Jun 3 '09

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 ..
Member
 
Join Date: Oct 2008
Location: India Bangalore
Posts: 37
#4: Jun 4 '09

re: oracle sub query issue


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