I have the following Sql statement that takes forever to execute.
Select * from view_frmOrientationSchedule where
(Select 1 from dbo.NotesTbl
INNER JOIN dbo.View_EmployeesLastNoteID ON dbo.NotesTbl.ID = dbo.View_EmployeesLastNoteID.LastID
Where NotesTbl.EmployeeID = view_frmOrientationSchedule.EmployeeID and Date >= '02/01/15')
I guess the reason is because the Notestbl is very large (over 1.5 Mil rec.).
What are my options?
The intention of the query is to select records of all Employees who's last note were entered in a specific date range.
P.S. I know if would be possible to join the notes table to the main table (view_frmOrientationSchedu
le) it would probably solve the issue, however this option is currently not relevant.