-3

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.

1 Answers1

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
  • 1
    Please, 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
  • 1
    Was 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
  • 1
    Please quote your PHP code correctly and adjust query to your database layout. Please read documentation. – frlan Jan 06 '15 at 11:16