There is a table cars with fields: id, firma, model, cost .

There is a second related sales table with fields: id, id_cars, sale .

How to display just the first table plus if there is a discount for a particular model add a column with this discount. If there is no discount then add nothing. Thank.

    1 answer 1

    so what?

     SELECT cars.id, cars.firma, cars.model, cars.cost, sales.sale FROM cars LEFT JOIN sales ON cars.id = sales.id_cars 
    • one
      Thank you! This is the speed !!!! - Alexander