0

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

なぜカウントが変わるのか、どのクエリが正しいのか知りたいです。

4

0 に答える 0