chnge query for a join file

  • Thread starter Thread starter JRough
  • Start date Start date
J

JRough

I need to change this query because I needed to add a join file
between company and car_owners.
There is a many to many between cars and owners. This is for rental
purposes. One car could have more than one owner_company and one owner
could have more than one cars. So to get this same query with the
join file, what do I do?
Select car_o.car_id AS car_id, co.comp_name AS comp_name,
car_o.start_date AS start_date,car_o.end_date AS end_date
from (MyDatabase.CAR_OWNER car_o
INNER JOIN MyDAtabase.COMPANY co)
where (car_o.comp_id=co.comp_id);

thanks,
 
Try this --
SELECT car_o.car_id AS car_id, co.comp_name AS comp_name, car_o.start_date
AS start_date, car_o.end_date AS end_date
FROM CAR_OWNER AS car_o LEFT JOIN COMPANY AS co ON car_o.comp_id = co.comp_id;
 
Back
Top