PNP_PIbd-31_Rodionov_I_A_Co.../data/requestDevices.sql
2025-01-14 21:28:06 +04:00

15 lines
396 B
SQL

SELECT
d.*,
l.name AS location_name,
TRIM(CONCAT(e.last_name, ' ', e.first_name, ' ', e.patronymic)) AS employee_full_name,
e.fk_id_department AS department_id,
dep.name AS department_name
FROM
device d
JOIN
location l ON d.fk_id_location = l.id
LEFT JOIN
employee e ON d.fk_id_employee = e.id
LEFT JOIN
department dep ON e.fk_id_department = dep.id;