-2

I have a table with multiple fields that I am grabbing information from (8 to be specific) but within this query I need to group on one field (ID's) and sum two other fields separately (Units, MV). I can pull all the information together in 2-3 queries but I want to know if i can pull/put everything together in one query.

The correct result would be a query that groups the results on the ID field only, has both Units and MV summed separately but also have the other fields I need too. I can get part of the results in one query if I only have the grouped ID field and summed Units and MV fields but if I add any other fields then the results are incorrect. Any assistance would be appreciated.

  • 1
    The 2-3 queries you have are probably what is needed. You could possibly nest queries for one super-long sql statement. – June7 Nov 20 '19 at 21:41
  • If the results become incorrect when adding more tables, this probably means that the the sums are multiplied by the number of linked records. If this is the case, then you will have to do the grouping only by ID in a separate query (which can also by a subquery) and join this to the other tables. – Wolfgang Kais Nov 20 '19 at 23:46
  • @Wolfgang Kais This is just a query from one table not multiple tables – ThatTallGuy88 Nov 25 '19 at 13:46
  • 1
    If the results become incorrect when adding more fields, this probably means that the the sums are split by the combinations of combinations of the other values. If this is the case, then you will have to do the grouping only by ID in a separate query (which can also by a subquery) and join this to the table using the ID column. That menas the the same sum will appear in all rows containing that same ID. – Wolfgang Kais Nov 27 '19 at 08:27

1 Answers1

0

I ended up messing around with using DISTINCT within the SQL portion of access and finally got the results. Thank you for all your help!