Simple SQL 2 Tables data grouping

I need to complete the following task in SQL: Show the employment status in individual offices of the company in the following layout: office code, country, number of employees.

Table employees: enter image description here

Table offices: enter image description here

My idea was:

SELECT officeCode, (SELECT country FROM offices), COUNT(*)
FROM employees
GROUP BY officeCode

But it seems it doesn’t work… Can you help?


Your main data set would be the office. Join to the employee’s table by the office code. Then from your main table, get the data you need and then do a count( employee number) Remember to add all the fields that you are displaying to the group by.