我有 2 个查询,当在内部选择查询中移动 where 子句时,这两个查询都显示不同的结果。
select destination_number, count(*) as cnt from (
select caller_id_number as caller_id_number, destination_number as destination_number
from Final1 where start_stamp > '2013-01-01 00:00:00' and start_stamp < '2013-01-26 00:00:00'
group by caller_id_number, destination_number)
where destination_number = '1234'
group by destination_number
计数结果:294636
select destination_number, count(*) as cnt from (
select caller_id_number as caller_id_number, destination_number as destination_number
from Final1 where destination_number = '1234' and start_stamp > '2013-01-01 00:00:00' and start_stamp < '2013-01-26 00:00:00'
group by caller_id_number, destination_number)
group by destination_number
计数结果:310627
我想知道为什么计数会改变以及哪个查询是正确的。