UPDATE rebeccaPennyBidding_bidss AS b JOIN ( SELECT b.id, p.start_date, p.start_time, p.duration FROM rebeccaPennyBidding_bidss b INNER JOIN ( SELECT product_id, MAX(timeAdded) AS last_bid_time FROM rebeccaPennyBidding_bidss GROUP BY product_id ) AS latest_bids ON b.product_id = latest_bids.product_id AND b.timeAdded = latest_bids.last_bid_time LEFT JOIN rebeccaPennyBidding_products p ON b.product_id = p.id WHERE DATE_ADD(STR_TO_DATE(CONCAT(p.start_date, ' ', p.start_time), '%Y-%m-%d %H:%i:%s'),INTERVAL p.duration SECOND) < '2024-12-22 21:56:42' AND b.winning_time = '' ) AS bids_to_update ON b.id = bids_to_update.id SET b.winning_time = UNIX_TIMESTAMP( DATE_ADD( STR_TO_DATE(CONCAT(bids_to_update.start_date, ' ', bids_to_update.start_time), '%Y-%m-%d %H:%i:%s'), INTERVAL bids_to_update.duration SECOND ) )
Deadlock found when trying to get lock; try restarting transaction