I haven't found the answer to this in the mySQL help files or in my other usual sources. . . it essentially is a question of exactly how GROUP BY treats columns with numbers in them.
I have created a query that returns the following cols:
SalesmanID (number)
SalesmanName (text)
MonthlyTarget (number)
JanSales (number)
FebSales (number)
. . .
DecSales (number)
Due to a tables limitation, it returns each month's sales amount for a given SalesmanID as a seperate line/record. I'd like to use GROUP BY SalesmanID to roll all 12 lines up into one line for each SalesmanID.
How do I tell GROUP BY to SUM the numbers in JanSales, FebSales, etc for all entries with a given SalesmanID? Also, how do I tell it NOT to SUM the numbers in other columns (like MonthlyTarget), and what happens if the numbers in these columns are different on some of the relevant entries?
Thanks for any insight/resources you can offer!
VBAjedi
I have created a query that returns the following cols:
SalesmanID (number)
SalesmanName (text)
MonthlyTarget (number)
JanSales (number)
FebSales (number)
. . .
DecSales (number)
Due to a tables limitation, it returns each month's sales amount for a given SalesmanID as a seperate line/record. I'd like to use GROUP BY SalesmanID to roll all 12 lines up into one line for each SalesmanID.
How do I tell GROUP BY to SUM the numbers in JanSales, FebSales, etc for all entries with a given SalesmanID? Also, how do I tell it NOT to SUM the numbers in other columns (like MonthlyTarget), and what happens if the numbers in these columns are different on some of the relevant entries?
Thanks for any insight/resources you can offer!
VBAjedi