我是MySQL的新手,我正在尝试解决查询问题。我正在运行一个cron作业,它从另一个数据库更新一个数据库,但我收到以下错误:
#1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以获得正确的语法 '和a.entity_id不在附近(从mg_asul'中选择magento_order_id) 第4行
以下是我要执行的查询:
select entity_id
from mg_sales_flat_order a
where status = 'complete'
and a.entity_id >
and a.entity_id not in
(select magento_order_id
from mg_asulpunto_unicentaopos_order_item b
where b.magento_order_id=a.entity_id)
据我所知,这似乎是mysql中表名和限制变量的问题,但到目前为止我还没能引用正确的表名。任何帮助将不胜感激。
答案 0 :(得分:1)
and a.entity_id >
select entity_id
from mg_sales_flat_order a
where status = 'complete'
and a.entity_id > /* Specify the value after > sign */
and a.entity_id not in
(select magento_order_id
from mg_asulpunto_unicentaopos_order_item b
where b.magento_order_id=a.entity_id)