0
我想加入2個表與內部聯接,第二個表是一個大表。所以當我運行查詢時間太長。這是我的查詢的示例。我想加入2表與內部聯接
select distinct name,number,ID,count
from Import A
inner join Claim B
on B.ClaimNo between A.beginClaimNumber and A.endClaimnumber
where cast(Receivedate as date) between ('2015-01-01') and ('2015-03-01')
and B.IO = 'O'
order by ID
「花太長時間」並不是真正的錯誤。可能有很多事情正在造成這種情況,其中沒有一個與您的查詢有關。從索引開始。 – paqogomez
刪除'WHERE'子句中的'CAST'和'BETWEEN'類,並嘗試一些'SARGable',請參閱http://en.wikipedia.org/wiki/Sargable –
確保您在索賠表上有索引在索賠否專欄'。 – Hiten004