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.