Zend certified PHP/Magento developer

The cron task indexer_update_all_views failed | SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘entity_id’ in where clause is ambiguous

Sorry for my bad English.

I am using Magento 2.4.6-p4 CE and I get the following error after every order.

The job indexer_update_all_views scheduled at **date** **time** failed with the following error message: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguous, query was: SELECT `o`.`entity_id`, `o`.`increment_id`, `o`.`customer_id`, `o`.`billing_address_id`, `o`.`customer_email`, `o`.`customer_firstname`, `o`.`customer_lastname`, `o`.`status`, `o`.`created_at`, GROUP_CONCAT(oi.product_id) AS `products`, `billing_address`.`city` AS `billing_city`, `billing_address`.`company` AS `billing_company`, `billing_address`.`postcode` AS `billing_postcode`, `billing_address`.`street` AS `billing_street`, `billing_address`.`telephone` AS `billing_telephone`, `shipping_address`.`city` AS `shipping_city`, `shipping_address`.`company` AS `shipping_company`, `shipping_address`.`postcode` AS `shipping_postcode`, `shipping_address`.`street` AS `shipping_street`, `shipping_address`.`telephone` AS `shipping_telephone`, GROUP_CONCAT(comment SEPARATOR "n") AS `comment` FROM `sales_order` AS `o` LEFT JOIN `sales_order_item` AS `oi` ON oi.order_id = o.entity_id LEFT JOIN `sales_order_address` AS `billing_address` ON billing_address.entity_id = o.billing_address_id LEFT JOIN `sales_order_address` AS `shipping_address` ON shipping_address.entity_id = o.shipping_address_id LEFT JOIN `sales_order_status_history` AS `history` ON history.parent_id = o.entity_id AND history.entity_name="order" WHERE (o.entity_id > 0) AND (entity_id IN ('512')) GROUP BY `o`.`entity_id` ORDER BY `o`.`entity_id` asc LIMIT 1000

if I do reindex and cron run, the problem is over.

How can I solve?

Thanks for support and answer.