SELECT
divisions.`name` AS 'Подразделение',
`staff units`.`name` AS 'Штатная единица',
`staff units`.salary AS 'Оклад',
`unit type`.`percentage of allowances` AS 'Процент надбавки за вредные условия труда',
`staff units`.`percentage of allowances` AS 'Процент надбавки за ненормированный рабочий день',
(`staff units`.salary * (1 + `unit type`.`percentage of allowances` + `staff units`.`percentage of allowances`)) AS 'Зарплата'
FROM
`distribution of staff members`
JOIN
divisions ON `distribution of staff members`.iddivision = divisions.id
JOIN
`staff units` ON `distribution of staff members`.idstaffunit = `staff units`.id
ORDER BY
divisions.`name`;
Есть идеи, как дописать к FROM объединение между distribution of staff members и unit type, где unit type.id является внешним ключем таблицы divisions.idunit. HELP!
SELECT
divisions.`name` AS 'Подразделение',
`staff units`.`name` AS 'Штатная единица',
`staff units`.salary AS 'Оклад',
`unit type`.`percentage of allowances` AS 'Процент надбавки за вредные условия труда',
`staff units`.`percentage of allowances` AS 'Процент надбавки за ненормированный рабочий день',
(`staff units`.salary * (1 + `unit type`.`percentage of allowances` + `staff units`.`percentage of allowances`)) AS 'Зарплата'
FROM
`distribution of staff members`
JOIN
`staff units` ON `distribution of staff members`.idstaffunit = `staff units`.id
JOIN
divisions ON `distribution of staff members`.iddivision = divisions.id
JOIN
`unit type` ON divisions.idunit = `unit type`.id
ORDER BY divisions.`name`;
Сборка персонального компьютера от Artline: умный выбор для современных пользователей