例如 - 无论是通过viewC还是直接从tableC查看,下面的field3都是完全相同的字段。然而查询会产生不同的结果。
select
(sum(a.field1) + sum(b.field2) ) / sum(c.field3)
from tableA a
left join tableB b on a.id = b.id
left join tableC c on a.id = c.id
where datefield > 2017
and a.id > 1000
VS
select
(sum(a.field1) + sum(b.field2) ) / sum(c.field3)
from tableA a
left join tableB b on a.id = b.id
left join viewC c on a.id = c.id
where datefield > 2017
and a.id > 1000