Given two tables:
event list table represent the driving violations of the driver , o_id is the violation number(id), d_id is the driver id, odate is the date of the violation
driver table represent the driver details, the birthday is the year of the birth e.g
Write query that finds the name and the birth yaer of the oldest driver that have made at least one violation that lives in Haifa
SELECT DISTINCT name, birthday FROM driver INNER JOIN event_list ON driver.d_id=event_list.d_id GROUP BY name, birthday,address HAVING MIN(birthday) AND driver.address='haifa';
I have a problem with the minimum, the output is all the drivers that have made at least one violation that living in Haifa, but all of them, not the oldest one, how can I improve my code? I need only the oldest.