Question on Previous anf post bill date

Analytics
Visitor

Question on Previous anf post bill date

Hello .
I am looking to do the following :
a) if an order is placed ( mike1.table2) then look at the last(not sum or count just the very prev bill)
 bill_dt and bill_amt prior to order being placed(mike1.table1)and print those 2
b) also print the very next bil_dt and bill_amt after the order is placed(not sum or count just the very next bill)
I also need all the columns in column2+Bill_dt and Bill_amt from table 1 for both previous bill and post order bill
if no order placed even then we put the last known bill_dt and amt

 

data:

mike1.table 1    mike1.table2    
Bill_dtBill_amt Acct_number acct_numberorder placed dateorder numberplaced bydepartment
11/1/2017$200123455 12345512/15/20174354354353mikesales
12/1/2017$250123455      
1/1/2017$300123455      

 

desired result:

 

       DerivedDerivedDerivedDerived
bill_dtbill_amt acct_numberorder placed dateorder numberplaced bydepartmentPrev_bill_datePrev_bill_amtNext_bill_dtPost_bill_amt
11/1/2017$200123455        
12/1/2017$25012345512/15/20174354354353mikesales12/1/2017$2501/1/2017$300
1/1/2017$300 123455