Solved

Oracle select stmt

Posted on 2014-09-05
1
370 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 32

Accepted Solution

by:
awking00 earned 500 total points
ID: 40305800
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
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…

820 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