SQL 命令未正确结束 驱使我香蕉



我正在尝试运行此查询,但我反复收到错误消息。 有什么建议吗?

SELECT DD_INTERVAL, VENDOR_ID, COUNTRY, "SUM"(VOLUME) as Volume, "SUM"(COST) as Cost
FROM Table_1
WHERE VENDOR_ID ='35',
    DD_INTERVAL = '7',
    COUNTRY = ('idn','lao','mys','phl','sgp','tha','vnm')
GROUP BY DD_INTERVAL, Vendor_ID, COUNTRY;

根据我对SQL的了解,您的查询应如下所示

SELECT DD_INTERVAL, VENDOR_ID, COUNTRY, SUM(VOLUME) as Volume, SUM(COST) as Cost
FROM Table_1
WHERE VENDOR_ID ='35'
AND DD_INTERVAL = '7'
AND COUNTRY IN ('idn','lao','mys','phl','sgp','tha','vnm')
GROUP BY DD_INTERVAL, Vendor_ID, COUNTRY;
  1. 引号不应在SUM
    周围

  2. 您需要在每个 where 子句之间有一个ANDOR,具体取决于您要查找的结果。

  3. 您的COUNTRY =应该是 COUNTRY IN

相关内容

  • 没有找到相关文章