Question: Group by on same table not return most recent record
I have records in appointment table with patient information.When i try to fetch latest patient appointment using group by it doesn't give me right result.I used group by with order php error by.Attached the table schema and query
Query :
SELECT * FROM `appointment` where appointment.patient = 2650 group by appointment.patient order by appointment.id desc
Above query return record whose id is 6718
Note : In this query i have added where condition only for one php error patient and i want the all patient latest appointment.