Locopete99
Registered User.
- Local time
- Today, 01:07
- Joined
- Jul 11, 2016
- Messages
- 163
Hi Guys,
I have a table which shows all the sales for my company for a year.
I want to create a query that sums all of the sales for each user but also shows some other information.
This would then return the Top 50 customers.
The query I have so far is as follows:
The problem is, I'm using a totals query so for every other field in my query I am getting an error that states "Your query doesnt include specified field x as part of the aggregate function."
Can anyone point me in the right direction.
Basically I want a query that sums up all of the MTD Net Sales grouped by user code, but then showing also the User code and Name, as wells as the salesmans name and customer group code.
All my attempts so far are erroring.
Ideally as well the next step would be to pull in the MTD Net Sales from the LASTFY table and have a comparison between the last FY sales and the current FY sales for each user.
I have a table which shows all the sales for my company for a year.
I want to create a query that sums all of the sales for each user but also shows some other information.
This would then return the Top 50 customers.
The query I have so far is as follows:
Code:
SELECT TOP 50 Tbl_CurrentFY.Salesperson, Tbl_CurrentFY.[User code], Tbl_CurrentFY.[User Name], Tbl_CurrentFY.[Customer Group], Sum(Tbl_CurrentFY.[MTD net sales]) AS [SumOfMTD net sales]
FROM Tbl_CurrentFY, Tbl_LastFY
GROUP BY Tbl_CurrentFY.[User code]
ORDER BY Sum(Tbl_CurrentFY.[MTD net sales]);
The problem is, I'm using a totals query so for every other field in my query I am getting an error that states "Your query doesnt include specified field x as part of the aggregate function."
Can anyone point me in the right direction.
Basically I want a query that sums up all of the MTD Net Sales grouped by user code, but then showing also the User code and Name, as wells as the salesmans name and customer group code.
All my attempts so far are erroring.
Ideally as well the next step would be to pull in the MTD Net Sales from the LASTFY table and have a comparison between the last FY sales and the current FY sales for each user.