Dear Friend,
I want to fetch max top three salary from our emp table which having different different sal.For example
name sal
john 4000
fred 3000
joseph 4500
xyz 4300
abc 6000
Our result should return only abc,joseph and xyz
So please tell me how to write query for this
Thanks
Imtiaz
Yes, you want to show just distinct salaries but still with names.
You want to see xyz, abc and abcl with their salaries.
My question is: Why do you want to see abc and not joseph? How to decide which emp show and which not in case of same salaries?
Select max(name), sal from emp
group by sal
order by sal desc
I don't know how significant 'name' is going
to be in the output, but use max(), min()
function with name accordingly, if it is
just a matter of finding largest or smallest alphabet?!!
Bookmarks