ChouChou
2021-01-02T08:02:47+00:00
[url]https://www.bilibili.com/video/BV12b411K7Zu?p=98[/url]
学的是这个第三题
报错信息
1 queries executed, 0 success, 1 errors, 0 warnings
查询:select * from `departments` d where `department_id` = ( select `department_id` from `employees` group by `department_id` order b...
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inner join
(select avg(salary) ,`department_id` from `employees`
GROUP BY `d' at line 8
学的是这个第三题
SELECT * FROM `departments` d
WHERE `department_id` = (
SELECT `department_id` FROM `employees`
GROUP BY `department_id`
ORDER BY AVG(`salary`)
LIMIT 1
)
INNER JOIN
(SELECT AVG(salary) ,`department_id` FROM `employees`
GROUP BY `department_id`) s0
ON s0.`department_id`=d.`department_id`
WHERE `department_id` = (
SELECT `department_id` FROM `employees`
GROUP BY `department_id`
ORDER BY AVG(`salary`)
LIMIT 1
)
INNER JOIN
(SELECT AVG(salary) ,`department_id` FROM `employees`
GROUP BY `department_id`) s0
ON s0.`department_id`=d.`department_id`
报错信息
1 queries executed, 0 success, 1 errors, 0 warnings
查询:select * from `departments` d where `department_id` = ( select `department_id` from `employees` group by `department_id` order b...
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inner join
(select avg(salary) ,`department_id` from `employees`
GROUP BY `d' at line 8