Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 re: can find colleagues but not second part?

Author  Topic 

Dek
Starting Member

7 Posts

Posted - 2001-11-13 : 21:02:41
Here is my table needed for query.

emp
empno | ename| hiredate | managerno | deptno

I want to query the emp table to display employees who have one or more co-workers in their department with a later hiredate but higher salaries.

My reasoning is to find employees and colleagues first and then find employers with later hiredate and higher salaries.
Perhaps I should take a different approach?

I am able to find all workers and their colleagues:

select employee.ename colleague.ename as colleague
from emp employee, emp colleague
where employee.deptno = colleague.deptno
and employee.empno <> colleague.empno;





   

- Advertisement -