Hi Folks, i'm using the query below to pull back the total quantity that a
salesperson has sold for a desired month. For some reason the numbers for
each item seem to be being doubled. Right now each sales person has two days
of sales for the month with the first day having 2 sales in each category
and the second day having 4 sales in each category. I would expect then to
get a sum of 6 for each category, but i'm getting 12. The best i can figure
is the daily numbers are being added (2+4) and then doubled (2*(2+4)), but i
have no idea why this would happen. Any help is really appreciated. thanks
in advance.
d
Query:
SELECT
u.first_nm
, u.last_nm
, c.category_nm
, c.category_id
, c.dataType
, c.department_id
, SUM(dn.quantity_nb)AS totalForMonth
, g.goal_nb
FROM
tblcategories c
, tblDailyNumbers dn
, tblUsers u
, tblGoals g
WHERE
c.department_id = 1
AND
DatePart("mm", dn.date_dt) = 9
AND
DatePart("yy", dn.date_dt) = 2001
AND
c.Category_id *= g.Category_id
AND
c.category_id *= dn.category_id
GROUP BY
u.last_nm
, c.category_nm
, c.category_id
, c.department_id
, g.goal_nb
, c.dataType
, u.first_nm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists