For some strange reason it is cutting off at the end of the current month regardless of how many days are left in the month.
If anyone can figure out where I screwed up I would be most appreciative.
The purpose of the query is to be able to send personalized emails and SMS texts, with the patients' name and appointment, to remind them of an appointment that will be coming up, but it is too soon to confirm, or a last minute reminder of an appt that has already been confirmed. I also use it to send "Thank You" emails to patients that have been in during the past week. I have three different Google Docs for the three different situations.
I create the query and export the results to a spreadsheet. Then I import the spreadsheet into a Google Docs email mail merge template. It works great except for the lists cutting off at the end of the current month.
- /*192*/ SET @FromDate=CurDate() , @ToDate=CurDate()+30;
SELECT p.LName,p.FName, DATE_FORMAT(ProcDate, '%m-%d-%y') AS 'Appt Date',p.Preferred,p.EMail AS 'Email address,Mobile text address'
FROM patient p, procedurelog pl
WHERE pl.PatNum=p.PatNum AND LENGTH(EMail)>3 AND
(pl.ProcDate BETWEEN @FromDate AND @ToDate)
AND pl.ProcStatus = '1' AND p.PatStatus=0
GROUP BY LName
ORDER BY pl.ProcDate