All,
I am attempting to join 2 tables containing customer number and sales. Table one has current month. Table two is all other months. Anyway, this has always worked with Access, but I can't seem to get SQL to return 1 record for each customer. Any help is appreciated.
SELECT STC_CUS_NO1 AS CUSTOMER, SUM(STC_TOT_INTL_AMT)AS SALES
FROM root_SAHSTC
WHERE STC_ACCTNG_PER BETWEEN 200501 AND 200512
GROUP BY STC_CUS_NO1
UNION
SELECT SAT_CUS_NO1 AS CUSTOMER, SUM(SAT_TOT_INTL_AMT) AS SALES
FROM root_SAHSAT
WHERE SAT_ACCTNG_PER > 200412
GROUP BY SAT_CUS_NO1
ORDER BY STC_CUS_NO1
Thanks
Scottie
I am attempting to join 2 tables containing customer number and sales. Table one has current month. Table two is all other months. Anyway, this has always worked with Access, but I can't seem to get SQL to return 1 record for each customer. Any help is appreciated.
SELECT STC_CUS_NO1 AS CUSTOMER, SUM(STC_TOT_INTL_AMT)AS SALES
FROM root_SAHSTC
WHERE STC_ACCTNG_PER BETWEEN 200501 AND 200512
GROUP BY STC_CUS_NO1
UNION
SELECT SAT_CUS_NO1 AS CUSTOMER, SUM(SAT_TOT_INTL_AMT) AS SALES
FROM root_SAHSAT
WHERE SAT_ACCTNG_PER > 200412
GROUP BY SAT_CUS_NO1
ORDER BY STC_CUS_NO1
Thanks
Scottie