472,111 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

Newbie: Find unique records

5
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
Mar 1 '08 #1
1 1122
taoh15
5
Sorry All Ignore my question.

As soon as I finished the post I realised the answer.
My excuse it that I am try to understand somebody elses code and my original question was going to be about a problem later on in the routine but as I wrote the post I realised I was going to ask the wrong question.

Definately a case of not seeingthe wood from the trees:-)
Cheers
Taoh
Mar 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Justin Hoffman | last post: by
9 posts views Thread by tshad | last post: by
3 posts views Thread by fong.yang | last post: by
2 posts views Thread by srusskinyon | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.