ElijahE (10/24/2013)
Adding a clustered index fixed it.Thank you both for your help! It's greatly appreciated!
You're welcome. I'm glad to assist.
ElijahE (10/24/2013)
Bhuvnesh, that would certainly return the same results and would probably be a better way of writing the query.
There is a logical difference between the two though.
Your query checks for rows duplicating mcrn & mpidm then returns any of those with an error_check of '142285'.
The second query checks for rows duplicating mcrn & mpidm with an error_check of '142285'.
With the following data the results will be different:
DECLARE @T TABLE
([mcrn] [varchar](41) NULL,
[mpidm] [int] NULL,
[Error_check] [varchar](50) NULL);
INSERT INTO @T VALUES
('Row1', 1, '142285'),
('Row1', 1, '0'),
('Row1', 1, '0');