View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 10:06 AM
Pankaj
 
Posts: n/a
Default Re: Duplicate Records

> The query is being cached - which is why it's quick the second time.
>
> Use a join instead of a sub select. It will be much faster. There are
> many examples of using joins in this way within these NGs.


Thanks.... I use this query and the results are already faster

SELECT *
FROM talent as e1
LEFT JOIN talent AS e2
ON (e1.s_first_name=e2.s_first_name and e1.s_last_name=e2.s_last_name
and e1.i_active=e2.i_active)
WHERE (e2.i_talent_id IS NOT NULL)
GROUP BY e1.s_first_name,e1.s_last_name,e1.i_active
HAVING COUNT(*) > 1

but this displays the results only once. I want to view the duplicates
as well. Any suggestions ?

Reply With Quote