I have a table with the following data:
create table tempdata(account varchar2(20)not null,bookid number(10),seqno number(20) not null,book_date date, book1 number(10), book2 number(10),book3 number(10)) insert into tempdata values('123',101,09,add_months((sysdate),-1),100,120,130); insert into tempdata values('123',101,10,sysdate),70,60,100) select * from tempdata; ACCOUNT BOOKID SEQNO BOOK_DATE BOOK1 BOOK2 BOOK3 123 101 9 9/22/2015 10:05:28 AM 100 120 130 123 101 10 10/22/2015 10:01:42 AM 70 60 100
I need to output something like the following in order to create another temporary table with the latest information about the book, including the previous date and last date:
ACCOUNT BOOKID SEQNO Previous_DATE Latest_date BOOK1 BOOK2 BOOK3 123 101 10 9/22/2015 10:05:28 AM 10/22/2015 10:01:42 AM 70 60 100
source share