2016-09-25 8 views
0

私は非常にMySQLの方が新しいので、クエリの問題を整理しようとしています。私が知っているからSQL構文エラーSELECT

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) 

:私は別の1つのデータベースを更新するcronジョブを実行していますが、私は次のエラーを取得しています:ここで

#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

は、私が実行しようとしているクエリですそれはmysqlのテーブル名と制限された変数に問題があるようですが、これまで私は正しいテーブル名を引用することができませんでした。どんな助けでも大歓迎です。

+2

'とa.entity_id>'の後に何かが欠けていますか? –

+0

'entity_id'は何よりも大きくする必要がありますか?コンパイラはあなたの心を読むことができません;) –

答えて

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) 
+0

ありがとうは完全に意味します。私が言ったように、私はMySQLにとって非常に新しいです。乾杯 – ZUBU