So, I am loading the results of this SQL into an array. The array later becomes a sentence for the text field that works when typing. I want him to return only one name 1 time, even if a person has several purposes. Currently, this returns all appointments for a person with that name, so if Brad Robins has 5 assignments and I start typing Brad, he displays Brad Robins 5 times in sentences, not just once.
$sql = "SELECT DISTINCT CONCAT(clients.studentFirstName, ' ', clients.studentLastName) AS name, appointments.location, appointments.subLocation, appointments.appointmentAddress1, appointments.appointmentAddress2, appointments.appointmentCity, appointments.appointmentState, appointments.appointmentZip, appointments.startTime, appointments.endTime, appointments.date, clients.school FROM appointments JOIN clients ON appointments.clientID = clients.clientID WHERE CONCAT(clients.studentFirstName, ' ', clients.studentLastName) = '".$roommate."' AND clients.school = '".$school."';";
It seems to me that DISTINCT and CONCAT just do not play together.
source share