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

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.
./fa/10311/0/


Thank you in advance


  • Attachment: SQL.JPG
    (Size: 19.08KB, Downloaded 91 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
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Easy query [message #561060 is a reply to message #561056] Wed, 18 July 2012 10:41 Go to previous message
Michel Cadot
Messages: 57613
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.

Regards
Michel
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: Sun Apr 20 22:23:40 CDT 2014

Total time taken to generate the page: 0.08999 seconds