Missing Keyword in JOIN syntax

与世无争的帅哥 提交于 2019-12-08 13:04:27

You have JOIN-WHERE-ON sequence which is wrong.

Should be something like this (assuming WHERE is not a part of your joining condition):

FROM employees e
JOIN jobs j ON e.job_id = j.job_id
....
....
WHERE e.salary >
  (SELECT AVG(salary) FROM employees WHERE job_id LIKE '%CLERK%')
ORDER BY ...

You cant have a join clause after a where clause

FROM employees e JOIN jobs j << you are missing the "ON" clause between employees and jobs here>> WHERE salary

in addition, move the WHERE clause after all the JOINs.

select
      fields
   from
      table
         join
            join "ON" clause
         join
            join "ON" clause
   where
      some condition
   group by
      whatever grouping if aggregates
   order by
      if you want something certain order.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!