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 931507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:30:47+00:00 2026-05-15T20:30:47+00:00

I have two tables. Table A has a list of employee names. Table B

  • 0

I have two tables. Table A has a list of employee names. Table B is a complex table with information about phone calls made by employees.

My goal is to make a table with columns ‘name’ and ‘callCount’. I am aiming to do this with a ‘left join’ and a ‘group by’, but I keep missing the employees that have made no calls. How can I just get it to keep the name and just put a zero there?

Perhaps I am close and someone can point out my typo? Thanks in advance for your help, here is the SQL:

SELECT A.name, COUNT(B.call_id) AS 'outgoing call count' 
FROM EmployeeTable A 
LEFT JOIN CallTable B 
ON A.name = B.call_from_name
WHERE B.call_type LIKE 'outgoing' 
AND B.voice_mail = '0' 
...
GROUP BY A.name 
  • 1 1 Answer
  • 1 View
  • 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-05-15T20:30:48+00:00Added an answer on May 15, 2026 at 8:30 pm

    It’s a JOIN not a NULL problem: your filter is changing the OUTER to an INNER JOIN. This means you only get COUNT where you have rows in CallTable (B) rather than the OUTER JOIN you wanted.

    SELECT A.name, COUNT(B.call_id) AS 'outgoing call count' 
    FROM
       EmployeeTable A 
       LEFT JOIN
       (
       SELECT call_from_name, call_id FROM CallTable
       WHERE call_type LIKE 'outgoing' 
         AND voice_mail = '0'
         AND /* other CallTable filters */
       ) B
       ON A.name = B.call_from_name
    WHERE
         /* only EmployeeTable A filters */
    GROUP BY A.name 
    

    Edit: after your comment elsewhere, all your filters on B must be in the derived table, not in the outer where.

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

Sidebar

Related Questions

I have two tables, one table has a list of videos, one has a
I have two tables. Widgets, which has information about each widget (Color, size, etc);
I have two tables, one table has some information in each row along with
I have two tables. One (Widgets) has a list of widgets (ID, widget_name, color,
I have two tables. The first table has a column with a lot of
I have two tables a parent and a child table. The child table has
I have two tables: Folder, Files. Each table has 4 fields: ParentID, ID, Name,
I have a database framework where I have two tables. The first table has
I have two tables, one is a table of forum threads. It has a
I have two tables. In the one table I have a list of dorm

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.