I am making a program for a school project in laravel, so I try to join two tables: products and destinations
The table Product has the columns: id, name
The Destinations table has this columns: Destinations:id,product_id,destination,quantity,target_person
and I need to join product_id and id
products = DB::table('products')
->leftJoin('destinations','id','=','destinations.product_id ')
->get();
but when I try to use LEFT JOIN I get the following error:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in on clause is ambiguous (SQL: select * from
productsinner joindestinationsonid=destinations.product_id)