Interviews9 answers
query to get maximum amount

Sukesh Marla
Posted Aug 12, 2012, 12:07 AM EDTConsider a table having a column say amount, write a query to get maximum amount without using order By and max keyword.
Interviews9 answers

Sukesh Marla
Posted Aug 12, 2012, 12:07 AM EDTmaximum amount means simple you use MAX()
select MAX(Amount) from tblaccount.
Declare @MaxValue int Select @MaxValue=(case when @MaxValue>Amount then @MaxValue else Amount end) From T1 Select @Maxvalue
Declare @MaxValue int Select @MaxValue=Amount From T1 Group by Amount Select @MaxValue
SELECT T11.Id, T11.Amount as MaxAmount FROM T1 AS T11 left outER JOIN T1 AS T12 ON T11.Amount < T12.Amount GROUP BY T11.Amount, T11.Id having COUNT(T12.Amount)=0
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegisterMembers onlyFeatured eBookClaude for AI-Native BuildersDownload nowAnswer an interview question and earn +10 SHARP for every answer.
See unanswered questions