need your help to modifying Access query

year      month      submission      Count            
2019      1             Category1      2            --------------------->A
2019      1             Category2      5            --------------------->B
2019      1             Category3      1            --------------------->B
2019      1             Category4      3            --------------------->A
this a simple query, need your help to modify and grouped by Submission

Category1 and Category4 should be group A and the total should be 5 (2+3)
Category2 and Category3 should be group B and the total should be 6 (5+1)

and finally the results should be:
Year   Month  Category      total
2019  1            A                   5
2019  1            B                   6
Roman FAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertConsultingCommented:
The easyest way for this is to add a group table, and define a relationship between the 2 tables.
Then the query will be a simple join.
Roman FAuthor Commented:
thank you, I need a single query possible using a switch?
Gustav BrockCIOCommented:
This should do:

Select [year], [month], IIf(submission=1 Or submission=4), "A", "B") As Category, Sum([Count]) As Total
From YourTable
Group By [year], [month], IIf(submission=1 Or submission=4), "A", "B")

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Roman FAuthor Commented:
thank you so much
Gustav BrockCIOCommented:
You are welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.