chnge query for a join file

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,
 
K

KARL DEWEY

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top