Solved

Oracle select stmt

Posted on 2014-09-05
1
351 Views
Last Modified: 2014-09-05
Greeting,

I have field1,field2 and field3 in tbl1. field3 is a date/time field with the following sample data.
I want to select the record which has the max(field3) and group by field1. Please suggest.

Field1    Field2   Field3
100        300       1-SEP-14
100        400       3-SEP-14
0
Comment
Question by:mrong
1 Comment
 
LVL 31

Accepted Solution

by:
awking00 earned 500 total points
Comment Utility
select field1, field2, field3 from
(select field1, field2, field3,
 row_number() over (partition by field1 order by field3 desc) rn
 from yourtable)
where rn = 1;
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now