oracle - Need sql statement to join two lists of data into one with one common variable -


i have table columns patient # , adverse event:

0101      headache   0101      vomiting   0105      pink eye  0201      fever   0201      skin rash   0201      cold   0204      coughing 

and second table columns patient # , medication:

0101      aspirin   0201      tylenol   0201      hydrocortisone   0201      midol   0201      benedryl   0201      advil   0203      ginkgo biloba   0204      advair   0204      triaminic 

i sql query combine 2 lists this:

0101      headache    aspirin   0101      vomiting    0105      pink eye       0201      fever      tylenol   0201      skin rash  hydrocortisone   0201      cold       midol   0201                 benedryl   0201                 advil   0203                 ginkgo biloba 0204      coughing   advair 0204                 triaminic 

basically dumping contents of 2 tables patient # (no relationship between adverse event , medication)

simple joins not give result need have row number partitioned patient:

select nvl(t1.patient,t2.patient),t1.adverse,t2.medication (select patient,              adverse,               row_number() on (partition patient order patient) rn        tbl1) t1 full outer join (select patient,              medication,               row_number() on (partition patient order patient) rn        tbl2) t2 on t1.patient= t2.patient    , t1.rn=t2.rn    order 1,2 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -