Selecting a Record With MAX Value
问题 In SQL Server 2008 I have a table CUSTOMERS that has two columns as: ID, BALANCE How can I write the query that selects the ID of the customer who has maximum balance, \" in the most effective way \"? Option 1: ORDER BY BALANCE and SELECT TOP(1) --> costs too much. Option 2: Firstly Get MAX amount , then make another query that uses the amount in where clause --> costs too much and not seem reliable. 回答1: Note : An incorrect revision of this answer was edited out. Please review all answers. A