Friday, March 23, 2012

getting similar fields in same output row for grouping totals

I have a table similar to the below:

Field1 Field2
EXE1 Age
EXE2 Child Under 10
EXE3 Not a citizen
WEB1 Cares for a child under 10
WEB2 Be a US Citizen

and I am getting the totals for the records grouped by Field1 - not a
problem. So, output is something like:

Field2 Total %
Age 10 .4
Child under 10 15 .5
Not a citizen 15 .5
Cares for < 10 20 .6
Be a US citizen 25 .7

However, IF there is an EXE# basically the same as a WEB#, then I need
to put them together in my report output, like so:

Field EXEtotal WEBtotal Total %
Age 10 0 10 .4
Child <10 15 20 35 1.0
Citizen 15 25 40 1.1

So, I'm getting the data I need returned, but don't know how to sort it
in my report to give me the new output I need.

I think I need to do this in my report output rather than my SQL
because I need to pull the individual information. Is there a way to
say "if Field 1 = 'WEB2' and Field 1 = 'EXE3', list in same row, then
total? I just don't know how to get them in the same row...

Thanks!

I would create a new column in the table to keep track of the parent group, ie.. your Web1 and Exe1 would be in the same Parent group.

Let me know if you can't make sense of it.

sql

No comments:

Post a Comment