milkman2500
Registered User.
- Local time
- Today, 02:37
- Joined
- Oct 21, 2012
- Messages
- 45
Hi,
I want to query both unique and non-unique values in the same query, without having to create multiple queries.
For example, I have a table that contains 1 column of divisions, 1 column of managers (repeating values) and 1 column of employees (non-repeating values).
I would like to create a query that counts the unique managers in a division, and the number of employees for each manager within that division. If I simply group by division and count managers and employees, the number of managers equals the number of employees (as it is counting the repeating frequencies).
I am currently overcoming this by creating 1 query that counts the employees, grouped by manager. Then creating a second query that counts the managers in the first query and sums the employees in the first query.
I want to query both unique and non-unique values in the same query, without having to create multiple queries.
For example, I have a table that contains 1 column of divisions, 1 column of managers (repeating values) and 1 column of employees (non-repeating values).
I would like to create a query that counts the unique managers in a division, and the number of employees for each manager within that division. If I simply group by division and count managers and employees, the number of managers equals the number of employees (as it is counting the repeating frequencies).
I am currently overcoming this by creating 1 query that counts the employees, grouped by manager. Then creating a second query that counts the managers in the first query and sums the employees in the first query.