Hi, I have a table with Company, SectionName, NumberOfStaff, and I want to run a query that shows this data, plus a column for the total of staff in each Company, obtained by adding the staff in the different sections.
I'm obtaining this number via its own query using Sum(NumberOfStaff) and Group By Company, which is then joined to the original query in the designer window. Is it possible to do it all in one query (maybe with a subquery, I'm not sure) - given that all the data comes from one table?
The reason for doing this is that the query is part of a larger macro that runs for about 5 minutes and (once I split the database) was returning 'Could not open any more databases' error. My job is to go through the macro, cleaning up all the extra bits and multi-nested queries that are causing this.
I have a feeling this is pretty basic, but my searching hasn't found anything. All info on subqueries seem put the subselect within the Where clause or Having bit, but I want it in the Select area.
thanks for any assistance
I'm obtaining this number via its own query using Sum(NumberOfStaff) and Group By Company, which is then joined to the original query in the designer window. Is it possible to do it all in one query (maybe with a subquery, I'm not sure) - given that all the data comes from one table?
The reason for doing this is that the query is part of a larger macro that runs for about 5 minutes and (once I split the database) was returning 'Could not open any more databases' error. My job is to go through the macro, cleaning up all the extra bits and multi-nested queries that are causing this.

I have a feeling this is pretty basic, but my searching hasn't found anything. All info on subqueries seem put the subselect within the Where clause or Having bit, but I want it in the Select area.
thanks for any assistance