Hi All
Although I have been using SQL2K for a number of years this is my first venture into more complicated stuff.
I have a query
SELECT apd.elid , apd.pcid , apd.apstatid , ap.empid
FROM ap RIGHT OUTER JOIN
ar ON ap.apid = ar.apid RIGHT OUTER JOIN
apd ON ar.arid = apd.arid
WHERE ap.empid IN (
SELECT emp.empid FROM emp LEFT OUTER JOIN
jt ON emp.empjt = jt.jtid
WHERE
(
emp.empislive = 1
)
Which works correctly, unfortuneately about 80% of what it produces are duplicate records - this is correct but I need to only have a set of
records which contain unique values for elid,pcid,apstatid and empid.
This is part of a set of routines which run once a day are are current handled by an external Application but it takes about 3 hours to run which is unacceptable on a 24x7 DB
How can I speed this up?
Thanks