Hi guys, I'm not 100% sure this is the place to ask this question but I couldn't see anywhere else more obviously relevant so here goes!My problem is this: I have a query which needs to find a bunch of totals, grouping together some things to find a sub-total, and to find a grand total. Mostly these are simple numerical values that come in under one field each. The spanner gets thrown into the works when I have a final option available for what is essentially a catchall for all other potential options.The people using the database can enter in a numerical value for products: VP1, VP2, VP3, VP7, VP8, VP9, ClassGrp however they can also enter in a string for 8 fields, GrpOther1-8. For example, GrpOther1 could be 'choir', GrpOther2 could be 'band', etc. There could be nothing entered in here also.What I used to do with a spreadsheet was sort them into a single column and run a COUNTIF. I am unsure how to make this work with the current code:SELECT "YearClass" AS "Year & Class", SUM( COALESCE( "ClassGrp", 0 ) ) AS "Laminated Class Photo", SUM( COALESCE( "VP1", 0 ) + COALESCE( "VP2", 0 ) + COALESCE( "VP3", 0) + COALESCE( "VP7", 0 ) + COALESCE( "VP8", 0 ) + COALESCE( "VP9", 0 ) + COALESCE( "ClassGrp", 0 ) ) AS "Group Total"FROM "StudentInfo"GROUP BY "YearClass"HAVING SUM( COALESCE( "VP1", 0 ) + COALESCE( "VP2", 0 ) + COALESCE( "VP3", 0 ) + COALESCE( "VP7", 0 ) + COALESCE( "VP8", 0 ) + COALESCE( "VP9", 0 ) + COALESCE( "ClassGrp", 0 ) ) > 0ORDER BY "YearClass" ASC
Ideally at the end I'll have the 'group total', 'laminated class photo' and then other headings with totals depending on what is input into the field.Any help would be hugely appreciated!