I would like to do the following query in MySQL:
SELECT DINSTINCT cstc.car_id FROM cars
JOIN customer_cars cstc ON cstc.age = student_cars.age
Where:
cars table has columns: car_id, name,…
customer_cars table has columns: car_id, age
student_cars table has columns: car_id, age
I know the query syntax is wrong because the student_cars table can not be recognized in this query (MySQL raise error).
(Basically, I would like to use the query to find out all car ids where customer_cars age equal to student_cars age)
So, how can I modify the query to make it working?
If you got you right, then that’s it (unverified):