Snowflake Vs MS-SQL - Part 8 - The value of another column for MAX value
The value of another column for MAX value
Suppose you have a data as below and if you want to get the details of another columns like employee_id based on MAX salary.
You can achieve this by writing query in multiple ways. One of the ways is writing sub query.
There is NO direct way to achieve this.
But there is a catch in this function, if there more than one row contains the maximum value for the salary column, the function is non-deterministic and might return the employee ID for a different row in subsequent executions.
On similar line there is function MIN_BY.
Comments
Post a Comment