G
Guest
Hello,
I've had a rough time trying to figure out how to write a query that can
analyze and aggregate this information. I'me hopeful one of you smart folks
can help me.
The table is essentially this:
Group_1
Num_1
Group_2
Num_2
Group_3
Num_3
I essentially need to combine all this information, based on Group Names.
So at any given time, Group_1 could be "Dogs", or Group_2, or Group_3, could
be "Dogs".
The number following the Group is associated with the preceding Group, which
I will need to sum up based on the Group_Name.
Here's an example:
Dogs
1
Cats
3
Horse
5
Next Row:
Horse
10
Dogs
20
Cats
30
I would like to query this information and get the following results:
Group_Name Count Sum
Dogs 2 21
Cats 2 33
Horse 2 15
The one main limitation is, I can't break up the original database into
multiple tables, it has to stay as one.
Is this sort of thing possible in a query? (There are actually 7 repeating
groups in the table)
Any help or a resource where I could learn about how to do this would be
greatly appreciated, thanks in advance!
-Dan
I've had a rough time trying to figure out how to write a query that can
analyze and aggregate this information. I'me hopeful one of you smart folks
can help me.
The table is essentially this:
Group_1
Num_1
Group_2
Num_2
Group_3
Num_3
I essentially need to combine all this information, based on Group Names.
So at any given time, Group_1 could be "Dogs", or Group_2, or Group_3, could
be "Dogs".
The number following the Group is associated with the preceding Group, which
I will need to sum up based on the Group_Name.
Here's an example:
Dogs
1
Cats
3
Horse
5
Next Row:
Horse
10
Dogs
20
Cats
30
I would like to query this information and get the following results:
Group_Name Count Sum
Dogs 2 21
Cats 2 33
Horse 2 15
The one main limitation is, I can't break up the original database into
multiple tables, it has to stay as one.
Is this sort of thing possible in a query? (There are actually 7 repeating
groups in the table)
Any help or a resource where I could learn about how to do this would be
greatly appreciated, thanks in advance!
-Dan