SEL col1,col2,col3, MAX(eff_date), COUNT(table2.xyz), ...
FROM table1, table2
GROUP BY 1,2,3
sel col1,col2..
DW_ACCT_ID_MAX.MAX_ID
FROM (SELECT MAX(ACCT_ID) MAX_ID FROM table2) DW_ACCT_ID_MAX,
table1 DT
JOIN table3 ACCT
ON ACCT.BUSN_TRUST_ACCT_EFF_DT = DT.DW_EFF_DT
AND ACCT.DW_EFF_DT <= DT.DW_EFF_DT AND DT.DW_EFF_DT <= ACCT.DW_EXPR_DT
AND ACCT.CURR_IN=1
AND ACCT.RCV_IN=1
........
and many joins are there below..
In my current query, this is being done like above. But is this not an efficient way to do as DW_ACCT_ID_MAX and DT are inner joined with no join condition and would result into a product join ?
KS42982 - Its is the same solution as yours. So, which is a better solution , diether's one or yours ?
↧