Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2014
    Posts
    2

    Unanswered: query to fetch columns from 2 subsequent rows into 1 row

    Table SYS_LOGIN_AUD
    ACT_DAT_TIME || ACTION || BSYS_NAME || ASYS_NAME || BLOGIN || ALOGIN || BEMP_ID||AEMP_ID

    12-AUG-2011 || I || NULL|| Sys1 || NULL || kannabu || NULL || 3231
    12-AUG-2012 || D || Sys1|| NULL || kannabu || NULL|| 3231 || NULL
    15-JAN-2013 || I || NULL|| Sys1 || NULL || kannabu || NULL || 3231
    12-MAR-2013 || D || Sys1|| NULL || kannabu || NULL|| 3231 || NULL
    12-AUG-2011 || I || NULL|| Sys1 || NULL || kannabu || NULL || 3231
    11-SEP-2012 || I || NULL|| Sys2 || NULL || sravana || NULL || 8862
    12-AUG-2014 || D || NULL || Sys2 || sravana || NULL|| 8862|| NULL

    Desired output

    START_DATE || END_DATE || SYS_NAME || SYS_LOGIN || EMP_ID
    12-AUG-2011 || 12-AUG-2012 || Sys1 || kannabu || 3231
    15-JAN-2013 || 12-MAR-2013 || Sys1 || kannabu || 3231
    11-SEP-2012 || || Sys1 || kannabu || 3231

    11-SEP-2012 || 12-AUG-2014 || Sys2 || sravana || 8862

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    rows in a table are like balls in a basket.
    which ball is the "next" ball?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2014
    Posts
    2
    The order of rows will be same as shown in the sample data

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    From where came the ouput?

    Desired output

    START_DATE || END_DATE || SYS_NAME || SYS_LOGIN || EMP_ID
    ...
    ...
    11-SEP-2012 || || Sys1 || kannabu || 3231
    ...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •