Home » SQL & PL/SQL » SQL & PL/SQL » Easy query
Easy query [message #561056] Wed, 18 July 2012 10:31 Go to next message
Messages: 1
Registered: July 2012
Location: Hungary (EU)
Junior Member

I think it will be easy most of you but I have thought about it a lot.
I would like to get back the date that I marked in the screenshot with red. So I need the abrsent_erl date which is on the highest ID row.

Thank you in advance

  • Attachment: SQL.JPG
    (Size: 19.08KB, Downloaded 109 times)
Re: Easy query [message #561059 is a reply to message #561056] Wed, 18 July 2012 10:39 Go to previous messageGo to next message
Messages: 24695
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

Re: Easy query [message #561060 is a reply to message #561056] Wed, 18 July 2012 10:41 Go to previous message
Michel Cadot
Messages: 63167
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select nbrob, abrsent_erl 
from mytable
where (nbrob, id) in (select nbrob, max(id) from mytable group by nbrob)

With any SQL question, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Previous Topic: ORDER BY in a particular order
Next Topic: How to join a table column names with data from other table
Goto Forum:

Current Time: Fri May 27 01:37:27 CDT 2016

Total time taken to generate the page: 0.09148 seconds