Page 1 of 1

Query for duplicate patients

Posted: Mon May 11, 2015 9:34 pm
by savvy
I would like a query that finds duplicate patient names.
Thanks!
Cheers!!

Re: Query for duplicate patients

Posted: Tue May 12, 2015 8:58 am
by jsalmon
Query #65 considers first and last names:

Code: Select all

/*65*/ 
/*WARNING: On versions before 14.3.1 that are using replication, do not run this query from multiple computers at the same time or replication will crash.*/
DROP TABLE IF EXISTS tmp;
CREATE TABLE tmp
SELECT COUNT(*) AS count, LName, FName FROM patient WHERE patstatus<>4 GROUP BY LName, FName HAVING count>1;
SELECT p.* FROM tmp, patient p
WHERE tmp.LName=p.LName AND tmp.FName=p.FName AND patstatus<>4 
ORDER BY LName,FName;
DROP TABLE IF EXISTS tmp;
http://opendentalsoft.com:1942/ODQueryL ... yList.aspx