I’m getting errors in Left join, below is my code.
$motorcyclebookFactory = $this->motorcyclebookFactory->create()
->getCollection()
->addFieldToFilter('product_id', $productCollectionData->getId());
$motorcyclebookFactory->getSelect()->joinLeft(
'rider_detail as wrd',
'wrd.booking_id = main_table.booking_id',
['booking_id', 'booking_series_id']
);
Error is
{
"code": "500",
"message": "SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'product_id' in where clause is ambiguous, query was: SELECT `main_table`.*, `wrd`.`booking_id`, `wrd`.`booking_series_id` FROM `motorcycle_book` AS `main_table`n LEFT JOIN `rider_detail` AS `wrd` ON wrd.booking_id = main_table.booking_id WHERE (`product_id` = '16533') AND (start_date between '2022-10-15' and '2022-10-15' OR end_date between '2022-10-15' and '2022-10-15' OR start_date <= '2022-10-15' and end_date >= '2022-10-15' )",
"data": null,
"success": false
}
how can I fix this, please help me with this
thank you.