i have created 5 column in sql database (eid,ename,esurname,edept,esalary),,, further i have created ten departments
and i have total employee 50 with 5 person in each dept, now what i want is : top 1o person with max salary with id in odd serie (for e.g id should be either 1 or 3 or 5...)
i have tried so far,,but no luck ,,i need a hint,, help me
here is what i tried :
select top 10 esalary as highestOne,ename,eid from(select *,ROW_NUMBER() over (partition by esalary order by eid desc)as row from empbiodata)as a where (row%2)!=0 order by esalary desc
This post has been edited by Atli: 04 August 2012 - 01:12 AM
Reason for edit:: Please use [code] tags when posting code.