---
title: "Why does max function in sql return multiple values"  
description: "Why does max function in sql return multiple values"  
author: "Jayden Bell"  
published: 2013-05-08  
updated: 2013-05-08  
canonical: https://www.mindstick.com/forum/840/why-does-max-function-in-sql-return-multiple-values  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# Why does max function in sql return multiple values

Hi Everyone!\
I would like to display the [player](https://answers.mindstick.com/qa/62213/name-the-cricketer-who-was-named-as-the-player-of-the-tournament-in-cricket-world-cup-2019) with the [highest salary](https://www.mindstick.com/forum/33705/find-nth-highest-salary-in-sql-serever).\
[select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) [max](https://www.mindstick.com/articles/1155/count-max-min-function-in-excel)(Salary) as highest_salary, p.[Last [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide)]from tbl_PlayersTable as p, tbl_team as twhere p.Team = t.TeamIDand TeamID = 1000[Group](https://yourviews.mindstick.com/view/81323/adani-green-energy-group-bags-world-s-biggest-solar-bid) by p.[Last name]The [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) is:\
highest_salary Last Name 8000 Bosh 7000 Wade 6000 JamesI just want to display (8000 Bosh since he is the player with highest salary).\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Jayden!\
You did't need MAX nor GROUP BY, just use TOP 1 with ORDER BY Salary DESC. Something like this:\
select TOP (1) Salary as highest_salary, p.[Last name]from tbl_PlayersTable as p, tbl_team as twhere p.Team = t.TeamID and TeamID = 1000ORDER BY Salary DESC


---

Original Source: https://www.mindstick.com/forum/840/why-does-max-function-in-sql-return-multiple-values

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
