Question

I am trying to run this query, but i repeatedly get an error message. Any suggestions?

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;
Était-ce utile?

La solution

From what I know about SQL your query should look like this

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. Quotes should not be around the SUM

  2. You need a AND or OR between each where clause depending the result your looking for.

  3. your COUNTRY = should be COUNTRY IN
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top