Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:23:32+00:00 2026-05-26T12:23:32+00:00

I have an Oracle table which has a name,value,time columns.Basically the table is for

  • 0

I have an Oracle table which has a name,value,time columns.Basically the table is for logging purposes to store what are the changes made to a particular name,what was the previous value and what time the change was made.

I need to formulate a query to fetch the top n changes for a particular name,and the output should have all the names in the table.
Any help/suggesstions?

Edit:

Name         Value     Time
Harish       Pass      1-Nov-2011
Ravi         Fail      2-Nov-2011
Harish       Absent    31-Oct-2011
Harish       Attended  31-Aug-2011 
Harish       Present   31-Jul-2011

I need to select details of Harish on 1st Nov,Oct 31st,31st Aug and Ravi.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:23:33+00:00Added an answer on May 26, 2026 at 12:23 pm

    Is this what you are after?

    My test set-up:

    SQL> alter session set nls_date_format = 'DD-Mon-YYYY HH24:Mi:SS';
    
    Session altered.
    
    SQL> drop table so_test;
    
    Table dropped.
    
    SQL> create table so_test  (
      2    n varchar2(32)
      3  , v varchar2(32)
      4  , t date );
    
    Table created.
    
    SQL> 
    SQL> insert into so_test values ( 'X' , 'Test1', to_date('01-Jan-2011 12:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> insert into so_test values ( 'X' , 'Test2', to_date('01-Jan-2011 13:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> insert into so_test values ( 'X' , 'Test3', to_date('01-Jan-2011 14:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> insert into so_test values ( 'Y' , 'Test5', to_date('02-Jan-2011 12:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> insert into so_test values ( 'Y' , 'Test6', to_date('03-Jan-2011 12:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> insert into so_test values ( 'Y' , 'Test7', to_date('04-Jan-2011 12:00:00','DD-Mon-YYYY HH24:Mi:SS') );
    
    1 row created.
    
    SQL> 
    

    Here is the query:

    SQL> select n,v,t from (
      2  select n, v , t , rank() over ( partition by n order by t desc) r
      3  from so_test
      4  ) where r <= 2;
    
    N                V                T
    -------------------------------- -------------------------------- --------------------
    X                Test3                01-Jan-2011 14:00:00
    X                Test2                01-Jan-2011 13:00:00
    Y                Test7                04-Jan-2011 12:00:00
    Y                Test6                03-Jan-2011 12:00:00
    
    SQL> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Oracle 9i database and OrderDetails table which has a column to
I have this table in an Oracle DB which has a primary key defined
I have a table which has columns of price and date , ordered by
I have a table in Oracle DB which has a field where procedure names
I have a table which has fields date_of_notification, date_of_loss. Both are of type time-stamp.
I have an oracle table which has a column that stores XML in a
I have an Oracle table which contains event log messages for an application. We
I have an entity that maps to an external oracle table which is one
I have to get data from Oracle Table in which I have one datefield
I have an Access 2002 application which links an Oracle table via ODBC with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.