Page 1 of 1

New Patient query

Posted: Thu Dec 30, 2010 7:13 am
by bstoute
Any assistance will be greatly appreciated, my MYSQL skills are lacking. I would like to have a query that gives a List of new patients within a given date range along with insurance carrier. It basically is a merger of the following queries.



/*323 Active Patients listed with Insurance Carrier, blank if they do not */
SELECT * FROM patient,p.PatNum,carrier.CarrierName
FROM carrier
WHERE DateFirstVisit >= '2010-12-01'
AND DateFirstVisit < '2010-12-31'
AND patient.patstatus = '0'
INNER JOIN insplan ip ON carrier.CarrierNum=ip.CarrierNum
INNER JOIN patplan pp ON ip.PlanNum=pp.PlanNum
INNER JOIN patient p ON pp.PatNum=p.PatNum

===================
List of new patients for a given date range

SELECT * FROM patient
WHERE DateFirstVisit >= '2010-12-01'
AND DateFirstVisit < '2010-12-31'
AND patient.patstatus = '0'


Thank you
Brian Stoute, DDS

Re: New Patient query

Posted: Thu Dec 30, 2010 3:28 pm
by excelalbertville
I am needing the exact same thing. I've tried multiple things on my own, but to no avail. Any help is appreciated.

Thanks,
Tiffany Morgan
Office Manager
Excel Dentistry

Re: New Patient query

Posted: Mon Jan 17, 2011 1:45 pm
by atd
How about this?

SELECT p.patNum, carrier.CarrierName, DateFirstVisit FROM patient p
LEFT JOIN patplan pp on pp.PatNum=p.PatNum
LEFT JOIN insplan ip on pp.PlanNum=ip.PlanNum
LEFT JOIN carrier on ip.CarrierNum=carrier.CarrierNum
WHERE DateFirstVisit >= '2010-12-01'
AND DateFirstVisit < '2010-12-31'
AND p.patstatus = 0
ORDER BY Carrier.CarrierName