mysql - SQL - Select distinct rows and join them with another table to get data -
mysql - SQL - Select distinct rows and join them with another table to get data -
i have 2 tables:
1) person (person_id, person_name)
2) cars (car_id, person_id)
i want people's names have cars no duplicates.
this have come with:
select person.person_name, cars.person_id cars inner bring together person on person.person_id=cars.person_id
but don't want duplicates, need incorporate using this:
select distinct person_id cars
select person_name person person_id in ( select person_id cars )
mysql sql
Comments
Post a Comment