J
jonnyjon
I am currently trying to shoehorn an analysis piece I'm doing into
Access - however I'm having trouble writing the appropriate SQL query
to extract data. The challenge is that I have two tables - the query
I want to run should aggregate the rows in the first table and put
together some totals for a particular geography. I then want to take
that query (via a subquery?) and join that with another table based on
some value.
The query which I have tried to create is:
SELECT * FROM(
SELECT DISTINCT DSSPLUS.REGION AS "LOCATION", SUM(YTDSLS) AS "SALES",
SUM(ACTUAL_COST) FROM DSSPLUS
WHERE MKT_PRODUCT_LINE='THREADED-EXTERNAL'
GROUP BY DSSPLUS.REGION
)
LEFT JOIN LOCATION_COST ON LOCATION_COST.REGION = DSSPLUS.REGION
Any thoughts?
Access - however I'm having trouble writing the appropriate SQL query
to extract data. The challenge is that I have two tables - the query
I want to run should aggregate the rows in the first table and put
together some totals for a particular geography. I then want to take
that query (via a subquery?) and join that with another table based on
some value.
The query which I have tried to create is:
SELECT * FROM(
SELECT DISTINCT DSSPLUS.REGION AS "LOCATION", SUM(YTDSLS) AS "SALES",
SUM(ACTUAL_COST) FROM DSSPLUS
WHERE MKT_PRODUCT_LINE='THREADED-EXTERNAL'
GROUP BY DSSPLUS.REGION
)
LEFT JOIN LOCATION_COST ON LOCATION_COST.REGION = DSSPLUS.REGION
Any thoughts?