Click here to Skip to main content
Sign Up to vote bad
good
See more: SQL-Server
select * from emp m where(select COUNT(distinct salary) from emp s where s.salary>m.salary)=0
 

 
can any one tell me what is the execution flow
 
[edit]code block fixed[/edit]
Posted 15 Dec '12 - 22:06
Edited 15 Dec '12 - 22:14
Nelek26.3K


3 solutions

In SQL Server Management Studio, you can show the execution plan. Click Ctrl+M, or from the menu, choose 'Query|Include Actual Execution Plan'.
 
This will vary depending on your table structure (which indexes are available), your table contents (statistics), your server hardware (RAM, number of CPUs), and your server load (the server will invest more resources building a plan if more resources are available).
 
So the only one who can tell what is the execution plan is you.
 
Good luck,
Pablo.
  Permalink  
Comments
Abhishek Pant - 18 Dec '12 - 2:30
Perfect,+5
I think that you can use MAX function...
 
For Example:
Select MAX(coloumn_name) from table_name;
 
Thanks.
  Permalink  
Comments
Sk. Tajbir - 16 Dec '12 - 14:16
5+
You can use this query with Max function like Mr. Tarun said,
select * from emp where salary = (select Max(salary) from emp)
 
This is will give you a list of employees who have highest salary.
 
I hope this will work.
Thanks Smile | :)
  Permalink  
Comments
Tarun Y Mangukiya - 16 Dec '12 - 23:24
Ya. The same Query we can use. But I can't suggest him because he has to learn all this himself. So, I just gave an example... Thanks.
Sk. Tajbir - 17 Dec '12 - 2:07
ok :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 424
1 Mahesh Bailwal 398
2 Maciej Los 205
3 Aarti Meswania 173
4 Rohan Leuva 165
0 Sergey Alexandrovich Kryukov 9,417
1 OriginalGriff 7,204
2 CPallini 3,933
3 Rohan Leuva 3,211
4 Maciej Los 2,743


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid