Report Help
Posted: Wed Mar 28, 2012 11:00 am
I got the following report from the favorites section on the open dental website.
/*303 List of active patients with no appointments in date range, includes phone numbers and address*/
SET @FromDate='2009-07-01' , @ToDate='2009-07-31';
SELECT CONCAT(p.LName, ', ',p.FName, ' ', p.MiddleI) AS Patient, CONCAT(" ", LEFT(p.HmPhone,13), "- ", LEFT(p.WkPhone,13), "- ",LEFT(p.WirelessPhone,13)) AS 'Phone Hm-Wk-Cell',
CONCAT(p.Address, " ", p.Address2, ", ", p.City, ", ",p.State, " ", p.ZIP) AS 'Full Address'
FROM patient p
LEFT JOIN appointment ap ON p.PatNum=ap.PatNum AND (DATE(ap.AptDateTime) BETWEEN @FromDate AND @ToDate) AND ap.AptStatus IN (1,2) /*sched or complete*/
WHERE ISNULL(ap.aptnum) AND
p.PatStatus=0
ORDER BY p.LName, p.FName ASC;
When i cut and paste it into the qury box I get the following error: Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server for the right syntax to use near ANDp.PatStatus=0ORDER BY p.LName, p.FName ASC' at line 1
any advice or help would be great. I get the error message with a lot of the reports I try to cut and paste
/*303 List of active patients with no appointments in date range, includes phone numbers and address*/
SET @FromDate='2009-07-01' , @ToDate='2009-07-31';
SELECT CONCAT(p.LName, ', ',p.FName, ' ', p.MiddleI) AS Patient, CONCAT(" ", LEFT(p.HmPhone,13), "- ", LEFT(p.WkPhone,13), "- ",LEFT(p.WirelessPhone,13)) AS 'Phone Hm-Wk-Cell',
CONCAT(p.Address, " ", p.Address2, ", ", p.City, ", ",p.State, " ", p.ZIP) AS 'Full Address'
FROM patient p
LEFT JOIN appointment ap ON p.PatNum=ap.PatNum AND (DATE(ap.AptDateTime) BETWEEN @FromDate AND @ToDate) AND ap.AptStatus IN (1,2) /*sched or complete*/
WHERE ISNULL(ap.aptnum) AND
p.PatStatus=0
ORDER BY p.LName, p.FName ASC;
When i cut and paste it into the qury box I get the following error: Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server for the right syntax to use near ANDp.PatStatus=0ORDER BY p.LName, p.FName ASC' at line 1
any advice or help would be great. I get the error message with a lot of the reports I try to cut and paste