Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:53:31+00:00 2026-06-02T15:53:31+00:00

Possible Duplicate: Selecting the Highest Seq Number by nested Joining Hello I have to

  • 0

Possible Duplicate:
Selecting the Highest Seq Number by nested Joining

Hello I have to write a query , I would like to take biggest sequence number for each client Id (big sequence number will be calculated based on highest bank account balance).

Please consider this table has 100000records.

table is like as below-

Table:

  
**ClID**      **SeqNu**     **Bal**  
1                 1              30000  
1                 2              26789  
1                 3              23456  
1                 4              12345  
1                 5              21234  
2                 3              12456  
2                 4              45632  
2                 1              23456  
2                 9              99999  
3                 4              12345  
3                 5              21234  
3                 3              12456  
3                 4              45632

Result would be

**ClID**      **SeqNu**         **Bal**  
1                 1              30000  
2                 9              99999  
3                 4              45632
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:53:35+00:00Added an answer on June 2, 2026 at 3:53 pm

    The best way to accomplish this will probably vary depending on which RDBMS you’re using. If you have windowing functions (Oracle 9i+ or SQL Server 2012, for instance), the following should work:

    select distinct ClId, 
                    first_value(SeqNu) 
                        over (partition by ClId 
                              order by Bal desc) as SeqNu, 
                    max(Bal) 
                        over (partition by ClId) as Bal
    from your_table
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: SQL query to find Missing sequence numbers I have a table which
Possible Duplicate: Change language programatically in Android I would like to develop an Android
Possible Duplicate: Selecting data from two different servers in SQL Server How can I
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: How do I Create a Comma-Separated List using a SQL Query? I
Possible Duplicate: Random number generator not working the way I had planned (C#) I
Possible Duplicate: Paypal Checkout Express empty cart problem i have an issue with paypal
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: Selecting a JSON object with a colon in the key I apologize
Possible Duplicate: Focus input field with JQuery without selecting current value text Using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.