tags:

views:

85

answers:

0

hi

here we have 3 tables .table1 and table2 have seq as common column.table3 contains terms related to 1 and 2 .now we want to find the number of seq in which each row in table 3 occurs.

table 1 
    col1      col2   
    seq1       m1
    seq2       m1
    seq3       m2
    seq4       m3
    seq1       m2 

table2 
col1       col2
seq1       t1
seq1       t0
seq2       t2
seq3       t5
seq4       t7
seq1       t2

table3
col1        col2       col3
m1           t1        t2
m1           t1         t0
m2           t2        t5
m2           t1          t5

i want output like below:

col1      col2    col3    col4
seq1        m1      t1     t2
seq2        m1      t1       t2
seq1        m2      t2       t5
seq4         m2      t2       t5

thanks in advance.