I am making a program for a school project in laravel, so I am trying to join two tables: products and directions
The Product table has columns: id, name
The Target table has the following columns: Directions: id, product_id, destination, quantity, target_person
and i need to join product_idandid
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]: Violation of integrity constraint: 1052 The column "id" in on is ambiguous (SQL: select * from productsinternal connection destinationson id= destinations. product_id)
source
share