Magento 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

magento.stackexchange https://magento.stackexchange.com/questions/267397

Pregunta

I am getting the Error:

Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

SELECT `main_table`.*, CONCAT(soa.firstname,' ', soa.lastname,'', soa.street,'', soa.city,'', soa.region,'', soa.postcode)  AS `full_address`, CONCAT(soas.firstname,' ', soas.lastname,'', soas.street,'', soas.city,'', soas.region,'', soas.postcode) AS `full_address_ship`, group_concat(`sales/order_item`.sku SEPARATOR ', ') AS `skus`, group_concat(`sales/order_item`.name SEPARATOR ', ') AS `names`, group_concat(`sales/order_item`.product_id SEPARATOR ', ') AS `proid`, group_concat(`sales/order_item`.product_type SEPARATOR ' ') AS `product_type`, `order`.`total_qty_ordered`, `order`.`customer_email` AS `emailbuyer` FROM `sales_flat_order_grid` AS `main_table`
 INNER JOIN `sales_flat_order_address` AS `soa` ON soa.parent_id=main_table.entity_id and soa.address_type = 'billing'
 INNER JOIN `sales_flat_order_address` AS `soas` ON soas.parent_id=main_table.entity_id and soas.address_type ='shipping'
 INNER JOIN `sales_flat_order_item` AS `sales/order_item` ON `sales/order_item`.order_id=`main_table`.entity_id
 LEFT JOIN `sales_flat_order` AS `order` ON order.entity_id = main_table.entity_id WHERE (status = 'processing') GROUP BY `main_table`.`entity_id` ORDER BY main_table.created_at DESC LIMIT 20

Why can't it find the status column?

¿Fue útil?

Solución

Here you have used more than one table so you have to use table.status instead of only status.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top