I have a driver table with ID, Car model, and Fastest Lap columns and would like to put that together with the Car table which has Car model, Horse power and cost columns. And I want my big table to have Id, Car model, fastest lap, Horsepower, Cost columns.
Asked
Active
Viewed 312 times
-3
-
10It is called a basic join. Please take a SQL tutorial first. – juergen d Jan 06 '15 at 10:30
-
By using JOIN clause. – Totoro Jan 06 '15 at 10:34
1 Answers
1
It's an easy JOIN
which might look like
SELECT * FROM "driver" JOIN "Car" on (driver.model = car.model)
Of course, car.model and driver.model needs to be the same. Ideal your connection is based upon a foreign key constraint. As stated in comments, a basic SQL tutorial is giving you some input here.

frlan
- 6,950
- 3
- 31
- 72
-
1Please, answering these type of questions will only encourage them to post more. This community is not meant for tutorials. – Payam Jan 06 '15 at 10:34
-
1Was thinking about but decided "gtfo n00b" is maybe also a bad idea as it destroys all motivation. – frlan Jan 06 '15 at 10:36
-
I've done this $result = mysqli_query($link,"SELECT FROM "Driver" JOIN "Car" ON (Driver.Car_model = Car.Car_model) "); But i get parse error – programming noob Jan 06 '15 at 10:42
-
1Please quote your PHP code correctly and adjust query to your database layout. Please read documentation. – frlan Jan 06 '15 at 11:16