Home > OS >  How to write SQL query leftjoin?
How to write SQL query leftjoin?

Time:05-26

with table like this I want to answer:

Given the Employee and AnnualReviews tables, write a query to return all employees who have never had a review sorted by HireDate. (Table link below)

Here is my query, kindly help to correction:

Select

LastName,
FirstName

from Employee a leftjoin AnnualReviews b ON a.`ID` = b.`EmpID`
where HireDate desc

Group by
ID

[employee & annual review][1]

[1]: employee & annual review table

CodePudding user response:

SELECT * FROM employee
WHERE terminationdate IS NULL AND lastname LIKE ‘SMITH%’
ORDER BY lastname, firstname;
  • Related