Left Outer Join Query Extremely Slow - SQL Server
<p>Huge issue with an SQL Server Query!</p>

<p>So the query below utilizes JOIN commands in the query, but takes no less than 15-20 minutes to run! No idea how to better optimize this code :(</p>

<p>Any ideas on how to fix this issue?</p>

<pre><code>SELECT dbo.DB_Timetrack.[JOB #], dbo.DB_Timetrack.[Last Name], dbo.DB_Timetrack.[First Name], dbo.DB_Timetrack.HOURS, dbo.DB_Timetrack.BEGDATE, dbo.DB_Timetrack.LOCATNID, 
                         dbo.DB_Timetrack.DESCR, dbo.DB_Timetrack.CODE, dbo.DB_Timetrack.TYPE, 
                         CASE WHEN dbo.DB_Job_status_open_and_closed.WS_Job_Number != '' THEN dbo.DB_Timetrack.Hours ELSE 0 END AS HoursWon, dbo.DB_Timetrack.NUMBERONLY, 
                         dbo.DB_Job_status_open_and_closed.WS_Job_Number_Only, dbo.DB_Job_status_open_and_closed.CREATDDT, DATEDIFF(Day, dbo.DB_Timetrack.BEGDATE, 
                         dbo.DB_Job_status_open_and_closed.CREATDDT) AS Date_Difference, DBCRM_MSCRM.dbo.DB_Opportunity_SalespersonID.new_GPSalespersonName, 
                         CASE WHEN DBCRM_MSCRM.dbo.DB_Opportunity_SalespersonID.new_GPSalesRepCode &lt;&gt; '' THEN DBCRM_MSCRM.dbo.DB_Opportunity_SalespersonID.new_GPSalesRepCode ELSE dbo.DB_Job_status_open_and_closed.Salesperson
                          COLLATE Latin1_General_CI_AI END AS SalespersonID

FROM            dbo.DB_Timetrack LEFT OUTER JOIN
                         DBCRM_MSCRM.dbo.DB_Opportunity_SalespersonID ON dbo.DB_Timetrack.NUMBERONLY COLLATE Latin1_General_CI_AI = DBCRM_MSCRM.dbo.DB_Opportunity_SalespersonID.Job_Num_Only LEFT OUTER JOIN
                         dbo.DB_Job_status_open_and_closed ON dbo.DB_Timetrack.NUMBERONLY = dbo.DB_Job_status_open_and_closed.WS_Job_Number_Only

WHERE        (dbo.DB_Timetrack.HOURS &gt; 0) AND (dbo.DB_Timetrack.DESCR &lt;&gt; '') AND (dbo.DB_Timetrack.BEGDATE &gt; CONVERT(DATETIME, '2013-01-01 00:00:00', 102))
</code></pre>

<p>Any suggestions would be greatly appreciated!</p>