Group column headings and sum their values

antifashionpimp

Registered User.
Local time
Today, 21:56
Joined
Jun 24, 2004
Messages
137
Hello,

can the following be done? :confused:

I have a one-rowed query, with the following column headings and values:

(see pic1)


I want similiar columns to be grouped and their respective values to be summed.
I.e.

(see pic2)

Can someone plese tell me how this is done in SQL?

I could just add the columns manually through the Design-View, but this would cause that new column headings that are added in the future to not be reflected in the query.

Jean
 

Attachments

  • pic1.jpg
    pic1.jpg
    14.7 KB · Views: 186
  • pic2.jpg
    pic2.jpg
    6.8 KB · Views: 180
What you want to do is have the query to identify field names, then group the field names according to their first letter, then to perform aggregate mathematical operations on data within the fields.

Off the top of my head, I can't imagine any queries that you can make without accessing the SysAccess tables (hidden), but with all the permutations available would become extremely unwieldy.

I have a better idea: Can you explain what the data is for in the first place? I mean, what do the field names mean in the first place? Insight into this design should make it much easier to create a proper query.
 
Hi mresann,

I took another path and solved this another way. My column headings are now data in rows; this has made the calculations much easier. Thanks for your help, I needed someone to tell me that this is just a bit too complicated for a simple problem :-)
 

Users who are viewing this thread

Back
Top Bottom