All pastes #956555 Raw Edit

Unnamed

public text v1 · immutable
#956555 ·published 2008-03-25 12:08 UTC
rendered paste body
....
	FROM dbo.EMP AS e
	LEFT OUTER JOIN dbo.EHIST AS eh
		ON e.EMPNUMBER = eh.EMPNUMBER AND CONVERT(datetime, eh.EHISTSTART) =
			(SELECT MAX(CONVERT(datetime, EHISTSTART)) AS Expr1
			FROM dbo.EHIST AS eh2
			WHERE (DATEDIFF(dd, @PayDate, CONVERT(datetime, EHISTSTART)) <= 0) AND (eh.EMPNUMBER = EMPNUMBER))
....
Which part of this join would cause the biggest performance hit? The CONVERT() statement, or the lack of an index on EMPNUMBER? Something else?