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.

asked Nov 13, 2014 at 10:20

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
answered Nov 13, 2014 at 12:05
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.