Hello everyone, i'm currently running a query that is returning some odd 
results. I'm trying to get the total number of sales in each category for a 
salesperson. The query i'm running is below. With the data i have right now 
i would expect to get back 4 for the total of sales per category for the 
month indicated. I am however, getting back a total of 144. Can anyone tell 
me what it is that is incorrect in my SQL statement that would cause this? 
Thank you for your help.

j

        SELECT
                  u.first_nm
                , u.last_nm
                , c.category_nm
                , c.category_id
                , c.dataType
                , c.department_id
                , dn.date_dt
                , SUM(dn.quantity_nb)AS totalForMonth
                , g.goal_nb
        FROM
                  tblcategories c
                , tblDailyNumbers       dn
                , tblUsers u
                , tblGoals g
        WHERE
                DatePart("mm", dn.date_dt) = 9
                AND
                DatePart("yy", dn.date_dt) = 2001
                AND
                u.user_id *= dn.user_id
        GROUP BY u.last_nm
                , c.category_nm
                , c.category_id
                , c.department_id
                , g.goal_nb
                , c.dataType
                , u.first_nm
                , dn.date_dt



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to