Here is my select statement,
SELECT TOP 1
EmpId, RemainingAdvance
FROM SalaryDetails
WHERE EmpId IN (SELECT Emp_Id
FROM Employee
WHERE Desig_Id='27')
ORDER BY CreatedDate DESC
When i executed SELECT Emp_Id FROM Employee WHERE Desig_Id='27' the results were
Emp_Id
16
17
But when i execute my first statement it gives me result for only 16 but no output 17...
I have records for both EmpId's in SalaryDetails Table.....
EDIT:
Removing TOP 1 from my query i got this,
SELECT EmpId, RemainingAdvance FROM SalaryDetails
where EmpId in (select Emp_Id from Employee where Desig_Id='27')
ORDER BY CreatedDate DESC
gave me

I want results for EmpId 16,17 ORDER BY CreatedDate DESC... Because my now my Desig_Id='27' and i will change it with a variable @CategoryId ... So there may be 'n' number of employees based on @CategoryId
EmpId RemainingAdvance
16 354.00
17 0.00