0

I have a data like this

AIN     ACCEPT_TYPE DATE1
91957753    A      04-NOV-14 12.50.31 PM
91957753    R      06-NOV-14 11.18.01 AM
919577      A      04-NOV-14 12.50.31 PM
919577      A      05-NOV-14 11.18.01 AM

And look for result like this

AIN     ACCEPT_TYPE_1   ACCEPT_TYPE_2   Date_1                  Date_2
91957753    A                 R             04-NOV-14 12.50.31 PM   06-NOV-14 11.18.01 AM
919577      A                 A             04-NOV-14 12.50.31 PM   05-NOV-14 11.18.01 AM

Is this possible.? Sorry i'm new to oracle .any help will be much helpfull.

1 Answer 1

1

It is quite simple:

select AIN,
       max(ACCEPT_TYPE) keep (dense_rank first order by date1) ACCEPT_TYPE_1,
       max(ACCEPT_TYPE) keep (dense_rank first order by date1 desc) ACCEPT_TYPE_2,
       min(DATE1) date_1, 
       max(DATE1) date_2
  from my_table
 group by AIN
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.