Question Locked

sql query

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
List the Name and hiredate of any employee hired after employee BLAKE.what wud b the sql query for this

3 replies

by blacknred0

the select statement would go something like this.

SELECT field_name, field_hiredate, field_employee
FROM table_employee
WHERE field_employee = "BLAKE"

by tony hopkinson

Declare @TargetDate DateTime
Select @TargetDate = Hiredate From Employees Where EmployeeID = 'BLAKE'
Select [Name,HireDate] From Employees Where HireDate > @TargetDate

The way I would be avoiding is called using a sub query.

Select [Name,HireDate] From Employees Where HireDate > (Select Hiredate From Employees Where EmployeeID = 'BLAKE'
)

Depends on how clever your DBMS is but it might run that subquery for every employee.

Very bad habit to get into...

This discussion is closed to new replies.