Wednesday, May 21, 2008

Re: You might need to scratch your head

Atif, it's seems like Imran has cracked this one!

Here we are with the solution;

SELECT Hire_T + 1
FROM ABC AS AC
WHERE NOT EXISTS
(
SELECT *
FROM ABC AS H
WHERE H.Hire_T = (AC.Hire_T + 1)
AND H.Number_Of_Employees_Hired > 0
)
AND Hire_T + 1 < (SELECT MAX(Hire_T) from ABC)


Can anyone else achieve the desired output in an alternate way?

1 comment:

Anonymous said...

Year 2002 is not coming