SQL inner joins | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

SQL inner joins

I’m having trouble figuring out exactly how to word the queries. We’re doing inner joins and I don’t have error in it but it won’t give me any results so there’s something I’m not getting.. this is the question and my query.. “Write the SQL statement that reports the employee is, employee full name and their job description. Sort the results by job description, employee last name, and then employee first name.” USE pubs SELECT employee.emp_id, employee.fname, employee.lname as EmployeeID, jobs.job_desc as JobDesc FROM employee INNER JOIN jobs ON employee.emp_id = jobs.job_desc ORDER BY JobDesc, employee.lname

3rd Nov 2020, 10:30 PM
Jay Elle
1 Answer
+ 1
The ON condition is wrong. Jobs table should have some column like emp_id, so should be ON employee.emp_id = jobs.emp_id. Just a guess, for better advice you have to show the table structure
3rd Nov 2020, 11:30 PM
Benjamin Jürgens
Benjamin Jürgens - avatar