query
Re: query
Hi,
I came up with the following query (based on one found in the query section) which seems to work, but I don't know how accurate it is. Any input is appreciated.
SELECT carrier.CarrierName,patient.*
FROM patient,carrier,insplan
WHERE patient.PatNum=insplan.Subscriber
AND insplan.CarrierNum=carrier.CarrierNum
AND carrier.CarrierName LIKE '%Aetna%'
/*only patients with procedures within the last year*/
AND EXISTS(SELECT * FROM procedurelog
WHERE procedurelog.PatNum=patient.PatNum
AND procedurelog.ProcDate > CURDATE() - INTERVAL 1 YEAR)
ORDER BY LName, FName
I came up with the following query (based on one found in the query section) which seems to work, but I don't know how accurate it is. Any input is appreciated.
SELECT carrier.CarrierName,patient.*
FROM patient,carrier,insplan
WHERE patient.PatNum=insplan.Subscriber
AND insplan.CarrierNum=carrier.CarrierNum
AND carrier.CarrierName LIKE '%Aetna%'
/*only patients with procedures within the last year*/
AND EXISTS(SELECT * FROM procedurelog
WHERE procedurelog.PatNum=patient.PatNum
AND procedurelog.ProcDate > CURDATE() - INTERVAL 1 YEAR)
ORDER BY LName, FName
- jordansparks
- Site Admin
- Posts: 5770
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: query
That's a good query. Keep in mind that it's only pulling subscribers, not other family members.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com