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 9096273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:48:15+00:00 2026-06-16T23:48:15+00:00

I have the following oracle database table USERS I have to display the user

  • 0

I have the following oracle database table USERS

enter image description here

I have to display the user status begin date&time and end date&time for each status.

From the above example I need to display like STEVE BALE is LOGGED_OUT from 01/08/2013 12:00:00 AM to 01/08/2013 5:04:24.736437 AM

and UNAVAILABLE from 01/08/2013 5:04:24.736437 AM to 01/08/2013 6:04:24.736437 AM,

and AVAILABLE from 01/08/2013 6:04:24.736437 AM to 01/08/2013 7:31:08.591801 AM…

similarly for the given day last record new status, useR STEVE BALE is LOGGED_OUT from 01/08/2013 11:30:50.724405 AM to 01/08/2013 11:59:59 PM..

Thank you for your time.

  • 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-06-16T23:48:17+00:00Added an answer on June 16, 2026 at 11:48 pm

    This is actually pretty easy, because oracle has the lead() function. Something like:

    select t.*,
           lead(status_change_date) over (partition by user_name order by status_change_date) as end_status_time
    from t
    

    For a string, you can do something like:

    select (t.user_name||' is '||t.new_status||' from '||
            to_char(status_change_date, 'mm/dd/yyyy hh:mi')+' to '||
            to_char(lead(status_change_date) over (partition by user_name order by status_change_date),
                    'mm/dd/yyyy hh:mi')
           ) as thestring
    from t 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an Oracle 11.2 database containing the following table: TABLE: SURVEY PARAMETER
I have the following table in an Oracle database: InvoiceNumber InvoiceDate InvoiceCorrelative ------------- -----------
I have the following translation table in an oracle 10g database: ID VARCHAR2(100 BYTE)
I have the following query that runs in my Oracle database and I want
I have the following PL/SQL stored procedure on an Oracle database: PROCEDURE MyProcedure (
I'd need advice on following situation with Oracle/PostgreSQL: I have a db table with
I currently have the following funciton in an oracle database that returns a concatenated
I have the following sql being run on an Oracle 10g database: select /*+
I'm using the following codes to add a user to a table called USERS
I have the following statement being run on an oracle database. SELECT br.Number FROM

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.