I'm trying to come up with a very simple report - Guarantors with mailing info for Last Visit Date between '2010-01-01' and '2013-01-01'.
Should be pretty simple, but I am not sure how to use the <> in the Patients Raw report, and no query in the sample query list has a date range.
Thanks!!!
Last Visit Betwween Report/Query Help
Re: Last Visit Betwween Report/Query Help
Sorry for the late reply. Does this give you what you are looking for?
SET @pos=0, @FromDate='2010-01-01' , @ToDate='2013-01-01';
SELECT
guarantor,
COUNT(DISTINCT patient.patnum) AS Dependents,
/*@pos:=@pos+1 as 'Count',*/
LName,
GROUP_CONCAT(DISTINCT (FName)),
DATE_FORMAT(MAX(ProcDate), '%m/%d/%Y') AS 'LastVisit',
Address,
Address2,
City,
State,
Zip
FROM
patient
INNER JOIN procedurelog
ON procedurelog.PatNum = patient.PatNum
WHERE procedurelog.ProcStatus = 2
AND PatStatus = 0
GROUP BY Guarantor
HAVING MAX(ProcDate) BETWEEN @FromDate
AND @ToDate
ORDER BY Lname ;
SET @pos=0, @FromDate='2010-01-01' , @ToDate='2013-01-01';
SELECT
guarantor,
COUNT(DISTINCT patient.patnum) AS Dependents,
/*@pos:=@pos+1 as 'Count',*/
LName,
GROUP_CONCAT(DISTINCT (FName)),
DATE_FORMAT(MAX(ProcDate), '%m/%d/%Y') AS 'LastVisit',
Address,
Address2,
City,
State,
Zip
FROM
patient
INNER JOIN procedurelog
ON procedurelog.PatNum = patient.PatNum
WHERE procedurelog.ProcStatus = 2
AND PatStatus = 0
GROUP BY Guarantor
HAVING MAX(ProcDate) BETWEEN @FromDate
AND @ToDate
ORDER BY Lname ;
Entropy isn't what it used to be...
Arna Meyer
Arna Meyer