SQL语法错误SELECT
I'm very new to MySQL and I'm attempting to sort out a query issue. I'm running a cron job which updates one database from another but I'm getting the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and a.entity_id not in (select magento_order_id from mg_asul' at line 4
Here is the query I am trying to execute:
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)
From what I know it seems to be an issue with table names and restricted variables in mysql but so far I haven't been able to quote out the right table names. Any help would be greatly appreciated.
我是MySQL新手,我正在尝试解决查询问题。 我正在运行一个cron作业,它从另一个数据库更新一个数据库,但我收到以下错误: p>
#1064 - 您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,使用正确的语法,使用 '和'a.entity_id not in(在第4行从mg_asul中选择magento_order_id p> blockquote> \ n
以下是我要执行的查询: p>
select entity_id from mg_sales_flat_order a 其中status ='complete' 和a.entity_id> \ n和a.entity_id不在 中(从mg_asulpunto_unicentaopos_order_item b 中选择magento_order_id ,其中b.magento_order_id = a.entity_id) code> pre>
据我所知 似乎是mysql中的表名和限制变量的问题,但到目前为止,我还没有能够引用正确的表名。任何帮助将不胜感激。 p> div>
You're missing something after 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)