Skip to content
Advertisement

Why this select selects no rows

I am trying to select a highest earner in ‘IT’ department, but I keep selecting no rows. Salary and names are in table called employees while department_name is in a table named departments. Can anyone please explain why does this select no rows and how should I do it?

Advertisement

Answer

Why this select selects no rows?

Your query fails because there is no column department_name in the employees table. So your subquery does not do what you expect:

If you want to do this with a subquery, you need to correlate it:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement