oracle - how to perform this step in sql query? -


i doing excel via vba, if can in query save me lots of time.

this 1 of 5 things need report working on.

tables
reading 3 different tables

tablea   tableb  tablec 

fields tablea

out_id 

fields tableb

timestamp event_type worker operator_id new_date 

fields tablec

worker 

query

select        tablea.out_id,        tableb.timestamp,        tableb.new_date,        tableb.event_type,        tablec.worker,        tableb.operator_id  tablea left outer join         tableb             on tablea.out_id = tableb.out_id ,                  tableb.event_type in ('worker_ret_cmt_chance','ret_chance','worker_status_chance') left outer join                tablec                  on tableb.worker = tablec.worker   tablea.time_stamp > {?pickdate} //parameter in crystal report pick date     , tablea.time_stamp < {?restdate}  //parameter in crystal report pick date     order tablea.out_id, tableb.timestamp 

here need do.

in event_type column if ret_chance has worker_ret_comment_chance in next row check if out_id same, if same check if timestamp difference less 10 seconds, if true copy worker number yellow cell red cell.

please see image blow , attached excel file sample. download excel file via dropbox

enter image description here

this not complete answer attempt clarify task. requires code not readable in comments. (everybody) please bear me.

will following self join create correct pairing of records:

from view1 v1 join view1 v2 on v1.out_id = v2.out_id ,                   v1.event_type = 'ret_chance' , v2.event_type = 'worker_ret_comment_chance' ,                                abs(extract(second v1.timestamp) - extract(second v2.timestamp)) < 10 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -