我正在尝试运行此查询,但我反复收到错误消息。 有什么建议吗?
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;
引号不应在
SUM
周围您需要在每个 where 子句之间有一个
AND
或OR
,具体取决于您要查找的结果。- 您的
COUNTRY =
应该是COUNTRY IN