I can currently query the join of two tables on the equality of a foreign/primary key in the following way.
$result = mysql_query(\"SELECT * FROM `table1`
try this method given below, modify to suit your need.
SELECT
employment_status.staff_type,
COUNT(monthly_pay_register.age),
monthly_pay_register.BASIC_SALARY,
monthly_pay_register.TOTAL_MONTHLY_ALLOWANCES,
monthly_pay_register.MONTHLY_GROSS,
monthly_pay_register.TOTAL_MONTHLY_DEDUCTIONS,
monthly_pay_register.MONTHLY_PAY
FROM
(monthly_pay_register INNER JOIN deduction_logs
ON
monthly_pay_register.employee_info_employee_no = deduction_logs.employee_no)
INNER JOIN
employment_status ON deduction_logs.employee_no = employment_status.employee_no
WHERE
monthly_pay_register.`YEAR`=2017
and
monthly_pay_register.`MONTH`='may'