Which method is better for finding max value in sql server? -


i want find max salary table , table employee contains following data

id  salary 1   5000 2   4000 3   1000 4   5000 5   2000 6   5000 7   5000 

here can use 2 method max salary,but don't know method better, there

select max(salary) employee or select max(distinct salary) employee 

please let me know query faster , better , why ?

without distinct. see max:

distinct not meaningful max , available iso compatibility only.

if think it, distinct mean in context? you're selecting one value - matter whether saw value once or 20 times in group of rows you're looking through maximum value?


Comments