List record from table by selects MAX value

i have a table as following:

Account(Acc_number,Acc_balance,branch_code)

Now i want to list all account details in each branch with the highest balance, how should I write the sql statement?

Simply said, i just want to list out all the branches, with the account of having highest balance.

Answers


There are similar questions.

You can use analytic functions.

Try this if it works for you:

    select branch_code,acc_number,acc_balance from
(
        select distinct acc_number,branch_code,acc_balance, 
        max(acc_balance) over(partition by branch_code order by 1) as MAX 
        from Account
)

    where acc_balance=MAX

Need Your Help

Working with Collections - Arraylist , Sorted list, Dictionaryentry

c# arraylist collections sortedlist

Below is my Code : The problem is when I am adding SortedList collection to Arraylist and at the time of retrieval it(SortedList) converts to DictonaryEntry Strange. Can anybody explain? Thanks in

repaint() call from the constructor

java swing

I'm trying to display loaded resource-image.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.