我有一个复杂的查询,我在stackoverflow中看到很多这样的问题,但没有发现我的查询有什么问题,我收到此错误
"完整性约束违规:1052列' orders_id'在字段列表中 是不明确的'"
当我尝试执行
时 SELECT order_process_status.process_status_id,
orders.orders_due_date,
order_process_status.process_status_class,
order_process_status_description.process_status_title,
Group_concat(DISTINCT Concat(orders.orders_id, '||',
orders.order_id_type, '||',
IF(orders.orders_due_date IS NULL, '', orders.orders_due_date), '||',
IF(orders.orders_due_date IS NULL,
'', IF(orders.orders_due_date < '2016-10-06', 'due',
IF(orders.orders_due_date =
'2016-10-06', 'today', IF(orders.orders_due_date = '2016-10-06' +
INTERVAL 1 day
, 'tomorrow', ''))))) ORDER BY orders_id DESC) AS orders_id
FROM order_process_status
LEFT JOIN order_process_status_description
ON order_process_status.process_status_id =
order_process_status_description.process_status_id
AND order_process_status_description.site_language_id = 1
LEFT JOIN orders
ON order_process_status.process_status_id =
orders.orders_status_id
AND orders.order_approval_status = '0'
AND orders.orders_date_finished > Date_sub(Now(),
INTERVAL 1 month)
LEFT JOIN orders_products
ON orders_products.orders_id = orders.orders_id
WHERE orders.store_id = 1
AND ( orders.admin_id IS NULL
OR orders.admin_id = 1 )
AND orders_products.template_type != -1
AND order_process_status.status_type = '0'
AND dashboard_visibility = '1'
AND process_status_complete != 1
AND process_status_cancel != 1
GROUP BY order_process_status.process_status_id
ORDER BY process_sort_order
我尝试添加此左连接时出现此问题
LEFT JOIN orders_products ON orders_products.orders_id = orders.orders_id
我在这里做错了什么?请建议我一种方式