我需要“生成一个查询以显示职位总数最少的两个分公司的分公司名称和职位总数。会计师工作的分公司决定了哪些职位与哪个分公司相关联。”
这是我试图回答的:
SELECT TOP 2 b.branchName, SUM(j.job_id)
FROM branch AS b
LEFT OUTER JOIN job AS j
ON b.branch_id - b.branch_id
ORDER BY sum(j.job_id);
我收到一个错误
Msg 4145, Level 15, State 1, Line 129 An expression of non-boolean type specified in a context
where a condition is expected, near 'ORDER'