簡體   English   中英

MySQL錯誤:沖突:1052 where子句不明確的列'created_at'

[英]Mysql error: violation: 1052 Column 'created_at' in where clause is ambiguous'

我遇到了問題:

違反完整性約束:1052 where子句不明確的列“ created_at”

但是表sales_flat_order_grid具有created_at

SELECT DISTINCT main_table.*, 
                blacklist.entity_id AS marked 
FROM   sales_flat_order_grid AS main_table 
       LEFT JOIN (SELECT main_table.* 
                  FROM   plugincompany_blacklist_item AS main_table 
                  WHERE  ( order_id != '0' ) 
                  GROUP  BY order_id) AS blacklist 
              ON main_table.entity_id = blacklist.order_id 
WHERE  ( created_at >= '2016-11-03 00:00:00' 
         AND created_at <= '2016-11-26 23:59:59' ) 

兩個表都有一個created_at子句。 所以mysql不知道該取哪個。 您需要清楚這一點:

WHERE  ( main_table.created_at >= '2016-11-03 00:00:00' 
     AND main_table.created_at <= '2016-11-26 23:59:59' ) 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM