Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8458649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:08:12+00:00 2026-06-10T13:08:12+00:00

I have a simple table Employees with this fields: ID, ParentID, Name ParentID is

  • 0

I have a simple table “Employees” with this fields:

ID, ParentID, Name

ParentID is Nullable since an employee may have no Manager.
This table has a one-to-many relationship with itself:

ID --one--to--many--> ParentID

Now I want a query which returns this columns:

Name, Count of rows where their ParentID equals to the current row ID (the row is the manager of that rows)

Sample Table:

ID | ParentID | Name
======================
 1 |     0    | John
----------------------
 2 |     1    | Bob
----------------------
 3 |     1    | Alice
----------------------
 4 |     3    | Jack

This way I can find an employee is the manager of how many other employees.
The result should be something like this:

Name  | Count of Employees
==========================
John  |   2
--------------
Bob   |   0
--------------
Alice |   1
--------------
Jack  |   0

How can I achieve this in MS ACCESS 2007?
* I have tried built-in query builder without any success.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:08:13+00:00Added an answer on June 10, 2026 at 1:08 pm

    So you just want a count of how many employees a manager has?

    You will have to join the table to itself. It can be done in the query builder but the SQL statement will be easier to put here.

    SELECT [Employees].Name, [Employees].ParentID, [Employees].Name, Count([Employees1].ParentID) AS NoOfEmployees
    FROM [Employees] LEFT JOIN [Employees] AS [Employees1] ON [Employees].ID = [Employees1].ParentID
    GROUP BY [Employees].ID, [Employees].ParentID, [Employees].Name;
    

    I added the two other columns from the tables and renamed the count column to NoOfEmployees.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple table that has this structure: <table> <thead> <tr> <td>Some info</td>
I have a simple table like this <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
I have a simple table. The first column has max-width set at 15px. It
I have a simple table with autoincrementing ID's and one text column. id(int), value(nvarchar)
I have a simple table (lets call it Table1) that has a NVARCHAR field
I have two tables almost identical: employee employee_history The second table has two additional
I have a table named as employee employee table fields and sample values --------------------------------
Say I have a table named EMPLOYEE, and the table has a field called
I have two classes. One is called Employee and the other EmployeeDetails that has
I have a simple employee table that I want to display in a particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.