Hi, I have been working on this problem all day and I cant get the logic right. we are asked "Given a specific taxi, list its history – drivers, accidents, mileage "
The SQL that I am using for this query is shown below:
SELECT Driver.[Driver ID], Rental.[Mile Out], Taxi.[Taxi ID], Taxi.Manufacturer, Taxi.[Date of Purchase], Taxi.[Accident Occurence]
FROM Taxi INNER JOIN (Driver INNER JOIN Rental ON Driver.[Driver ID] = Rental.[Driver ID]) ON Taxi.[Taxi ID] = Rental.[Taxi ID]
WHERE (((Taxi.[Taxi ID])=[Enter Taxi ID Number]));
I'm pulling the data from 3 different tables, this query works when the taxi has been rented out, however when taxi has no Rental ID the query doesnt show any other informations such as Date of Purchase or Manufacturer. I am told that the problem is "Taxi INNER JOIN (Driver INNER JOIN Rental ON Driver.[Driver ID] = Rental.[Driver ID]) ON Taxi.[Taxi ID] = Rental.[Taxi ID]" statement.
What i want to know is how to pull data based on information needed even though the taxi has not been rented by anyone else. Any help would be appreciated.