[亚马逊](500310)无效操作:语法错误在或附近"。&#34 ;;

时间:2018-04-10 20:02:32

标签: sql amazon-redshift squirrel-sql

感谢您对此提供任何帮助。 我意识到这之前会被问到,但我对这个错误完全感到困惑。我没有编写代码,我只是运行脚本,它曾经为我工作,但由于某种原因停止了工作。

我使用Squirrell连接到Amazon Redshift。由于我能够运行其他查询,因此我无法收集任何连接问题,这似乎是这个特定查询无法正常工作。

当我运行它时,我收到以下错误:



[Amazon](500310) Invalid operation: syntax error at or near ".";




这是我的代码:



SELECT 
'response = queue.send_message(MessageBody=''{"eventName": "reports", "user_id": "' 
+ h.userid + '",  "sales_date": "' 
+ To_char(Dateadd(d, -1, h.timestamp), 'YYYY-MM-DD') 
+ '", "seller_id": ' + cc.id 
+ ',   "include_saleitems": "True", "saleitems_limit":}'')' 
FROM   historicsales h 
       INNER JOIN eng_retailer 
               ON h.discountid = eng_retailer.discountid 
       INNER JOIN crm_retailer 
               ON eng_retailer.id = crm_customerretailer.retailerid 
       INNER JOIN crm_customer cc 
               ON crm_customerretailer.customerid = cc.id 
WHERE  To_char(h.timeofsale.timestamp, 'MONYY') = :MONYY 
       AND cc.discountedsellers = 'd' 
       AND ( ( Date_part(dayofweek, h.timeofsale) = :dayofweek ) 
              OR ( Date_part(dayofweek, h.timeofsale) = 
                   Date_part(dayofweek, h.timeofsale) 
                   AND :dayofweek = 8 ) ) 
       AND cc.id = :customerid 
ORDER  BY cc.id, 
          h.timeofsale; 




0 个答案:

没有答案