Click here to Skip to main content
12,352,091 members (31,700 online)
Rate this:
Please Sign up or sign in to vote.
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:06pm
Edited 15-Dec-12 22:14pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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,
Abhishek Pant 18-Dec-12 2:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I think that you can use MAX function...

For Example:
Select MAX(coloumn_name) from table_name;

Sk. Tajbir 16-Dec-12 14:16pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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 | :)
Tarun Y Mangukiya 16-Dec-12 23:24pm
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...

Sk. Tajbir 17-Dec-12 2:07am
ok :)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100