SQL Question

JeffK627

Active Member
Joined
Jun 22, 2005
Messages
313
Hello All,

Can someone help me out with a SQL query in Access? I need to turn this result set:

Code:
Product		Business_Unit	Code		State	State_Category		Quarter		TypeA_Units	TypeB_Units	TypeC_Units
PRODUCTA	Maintenance	00071053223	CA	CategoryA		Q1_2008		0		0		122.76
PRODUCTA	Maintenance	00071053223	CA	CategoryA		Q1_2008		0		2220.46		0
PRODUCTA	Maintenance	00071053223	CA	CategoryA		Q1_2008		1330		0		0

Into this:

Code:
Product		Business_Unit	Code		State	State_Category		Quarter		TypeA_Units	TypeB_Units	TypeC_Units
PRODUCTA	Maintenance	00071053223	CA	CategoryA		Q1_2008		1330		2220.46		122.76

In other words, I need to consolidate the 3 rows into 1 row with all the non-zero values for the 3 types of Units, as long as the first 6 fields are the same for all 3 rows. Any help will be much appreciated!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Take a look at Aggregate (Totals) Queries in Access help.

Basically, you will click on the Totals button in the Query Builder, which adds a Totals Row with the phrase "Group By" under each field. Just change the last three numeric fields from "Group By" to "Sum".
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top