Col 1,
col 2,
.....
.....
from
table1,
table2
........
........
where
join conditions1
join conditions1
................
.................
and
table1.day_key >= (select key from date_dim where value='01-JAN-2011')
and table1.day_key <= (select key from date_dim where value='31-DEC-2011')
and
table2.day_key >= (select key from date_dim where value='01-JAN-2011')
and table2.day_key <= (select key from date_dim where value='31-DEC-2011')
在这里我可以看到 date_dim 表在 where 条件下进行扫描四,如何避免它。在 main from 子句中未选择 date_dim 表。不幸的是,我没有环境来测试这个。数据库是oracle 10g