Codeman0013
MIS
- Jun 5, 2006
- 40
help i'm trying to group by so i only get one doctor if he is in the same department 2 times but with different locations here is my sql:
SELECT DOC_FIRSTNAME, doctor_matrix.DOC_ID, DOC_PHOTO, DOC_LASTNAME, VISIBLE_ID, DOC_TITLE, doctor_matrix.DEPTCONTACT_ID
FROM doctors, doctor_matrix, departments_contact
WHERE ((departments_contact.DEPT_ID = MMColParam) AND (doctor_matrix.DEPTCONTACT_ID = departments_contact.DEPTCONTACT_ID) AND (doctor_matrix.DOC_ID = doctors.DOC_ID) AND (VISIBLE_ID = 1))
GROUP BY doctor_matrix.DOC_ID
ORDER BY DOC_LASTNAME ASC
but i get an error about DOC_LASTNAME not aggregate or something help me please...
SELECT DOC_FIRSTNAME, doctor_matrix.DOC_ID, DOC_PHOTO, DOC_LASTNAME, VISIBLE_ID, DOC_TITLE, doctor_matrix.DEPTCONTACT_ID
FROM doctors, doctor_matrix, departments_contact
WHERE ((departments_contact.DEPT_ID = MMColParam) AND (doctor_matrix.DEPTCONTACT_ID = departments_contact.DEPTCONTACT_ID) AND (doctor_matrix.DOC_ID = doctors.DOC_ID) AND (VISIBLE_ID = 1))
GROUP BY doctor_matrix.DOC_ID
ORDER BY DOC_LASTNAME ASC
but i get an error about DOC_LASTNAME not aggregate or something help me please...