I have 2 tables (tblA and tblB) joined by ReportID key. This key is a Primary Clustered key on tblA, and is a FK on tblB. I have created a Non-clustered index on UserID and UserDate in tblA.
I have a query where I want to return a number of rows from tblB based off a ReportID selection from tblA.
My issue is the Execution Plan runs a Clustered Index SCAN on tblB. How do I get it to perform a seek? Or how can I improve the query execution?
Thanks!
SELECT
b.[Asset]
,b.[Investment]
,b.[Currency]
,b.[Address]
,b.[Email]
,b.[Region]
,b.[Country]
,b.[Sector]
FROM
tblB b
INNER JOIN
tblA a
ON a.ReportID = b.ReportID
WHERE a.UserID = @UserID
AND a.UserDate = @Period;
CREATE TABLE
scripts.