The situation is I have to join more than 10 different table. In the SQL I am joining the same table 5 times. The query looks like this.
select * from
Tab1
join Tab2 on Tab1.x = Tab2.x
.
.
.
join Tab10 t10 on
t10.x = 'xx' and
t10.y = 'yy' and
t10.z = 'zz'
join Tab10 t11 on
t11.x = 'aa' and
t11.y = 'bb' and
t11.z = 'cc'
join Tab10 t12 on
t12.x = 'dd' and
t12.y = 'ee' and
t12.z = 'ff'
join Tab10 t13 on
t13.x = 'gg' and
t13.y = 'hh' and
t13.z = 'ii'
join Tab10 t14 on
t14.x = 'jj' and
t14.y = 'kk' and
t14.z = 'll'
The reason why this Tab10 is joined 5 times is get the different values based on the parameter. Is it possible to rewrite Tab10 join in a better way? I also noticed due to this Tab10 join the performance is bad.