The following statement works fine in MySQL query editor, and DWMX recordset builder but gives the following error when trying to display in browser(PHP):
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING...
Here's my SQL:
SELECT residents.Resident_ID,
Max(IF(residents.Resident_ID=admissionassessment.Resident_ID,
DATE_FORMAT(admissionassessment.AdmissionAssessmentDate,'%m/%d/%Y'),"")) AS AdmissionAssessmentDate,
DATE_ADD(admissionassessment.AdmissionAssessmentDate,INTERVAL 90 DAY) AS AssessmentDueDate,
Max(IF(residents.Resident_ID=painassessment.Resident_ID,
DATE_FORMAT(painassessment.PainAssessmentDate,'%m/%d/%Y'),"")) AS PainAssessmentDate,
Max(IF(residents.Resident_ID=medicalrecords.Resident_ID,medicalrecords.MedicalRecordDate,"")) AS MedicalRecordDate
FROM ((admissionassessment
RIGHT JOIN residents ON admissionassessment.Resident_ID=residents.Resident_ID)
LEFT JOIN painassessment ON residents.Resident_ID=painassessment.Resident_ID)
LEFT JOIN medicalrecords ON residents.Resident_ID=medicalrecords.Resident_ID
GROUP BY residents.Resident_ID;
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING...
Here's my SQL:
SELECT residents.Resident_ID,
Max(IF(residents.Resident_ID=admissionassessment.Resident_ID,
DATE_FORMAT(admissionassessment.AdmissionAssessmentDate,'%m/%d/%Y'),"")) AS AdmissionAssessmentDate,
DATE_ADD(admissionassessment.AdmissionAssessmentDate,INTERVAL 90 DAY) AS AssessmentDueDate,
Max(IF(residents.Resident_ID=painassessment.Resident_ID,
DATE_FORMAT(painassessment.PainAssessmentDate,'%m/%d/%Y'),"")) AS PainAssessmentDate,
Max(IF(residents.Resident_ID=medicalrecords.Resident_ID,medicalrecords.MedicalRecordDate,"")) AS MedicalRecordDate
FROM ((admissionassessment
RIGHT JOIN residents ON admissionassessment.Resident_ID=residents.Resident_ID)
LEFT JOIN painassessment ON residents.Resident_ID=painassessment.Resident_ID)
LEFT JOIN medicalrecords ON residents.Resident_ID=medicalrecords.Resident_ID
GROUP BY residents.Resident_ID;