Это таблицы моей базы данных выглядят так:
regular_employee:
+----+---------------+-----------------+-----------+----------------+
| id | employee_name | employee_job | join_date | permanent_date |
+----+---------------+-----------------+-----------+----------------+
| 1 | ZELDA | ACCOUNTANT | 2020/02 | 2020/03 |
| 2 | YUGO | QA | 2020/02 | 2020/04 |
| 3 | XAVIER | GENERAL MANAGER | 2020/02 | 2020/05 |
| 4 | WAVY | FACTORY MANAGER | 2020/01 | 2020/02 |
+----+---------------+-----------------+-----------+----------------+
contract_employee:
+----+---------------+--------------+-----------+
| id | employee_name | employee_job | join_date |
+----+---------------+--------------+-----------+
| 1 | ANTONIO | ACCOUNTANT | 2020/01 |
| 2 | BAGGIO | ENGINEER | 2020/02 |
| 3 | CHARLES | QA | 2020/02 |
| 4 | DAVID | QA | 2020/02 |
+----+---------------+--------------+-----------+
Моя цель: Выбрать все employee_job, который присоединился к компании 2020/02 и разделяет / группирует их по employee_job
Что я пробовал:
SELECT re.employee_job,ce.employee_job
FROM regular_employee AS re,contract_employee AS ce
WHERE re.join_date = '2020/02' AND ce.join_date = '2020/02'
GROUP BY re.employee_job,ce.employee_job
Результат был:
+-----------------+--------------+
| employee_job | employee_job |
+-----------------+--------------+
| ACCOUNTANT | ENGINEER |
| ACCOUNTANT | QA |
| GENERAL MANAGER | ENGINEER |
| GENERAL MANAGER | QA |
| QA | ENGINEER |
| QA | QA |
+-----------------+--------------+
Что я ожидал:
+-----------------+
| employee_job |
+-----------------+
| ACCOUNTANT |
| ENGINEER |
| GENERAL MANAGER |
| QA |
+-----------------+
Как сделать этот запрос?