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 8732607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:28:10+00:00 2026-06-13T09:28:10+00:00

I am deveoping a c# app in which oledb connection is used. My table

  • 0

I am deveoping a c# app in which oledb connection is used.

My table is following

payment

Id   RemFee
1     2000
2     2500
1     1500
3     8000
3     5000
2      500
3        0

I want to select and check only last record of each Id and compare Remfee to 0. If it is greater than 0 then print the record. i.e. My expected result is:

Id  
1    
2     

In this check is made for Id 1 with RemFee 1500 (as it is last record with Id1). It is grater than 0 hence record is printed.

  • 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-13T09:28:11+00:00Added an answer on June 13, 2026 at 9:28 am

    Guessing you are using MSQ SQL Server and no row to know wich is your last inserted row. Try this code:

    SELECT Id, Min(RemFee) AS RemFee
      FROM payment
     WHERE RemFee > 0
     GROUP BY ID
    

    Here is an SQL Fiddle working code sample

    EDIT

    If you only want the ID field here is one option, together with the SQL Fiddle code

    SELECT myTable.Id
      FROM (SELECT Id as ID, Min(RemFee) AS Remfee
              FROM payment
             WHERE RemFee > 0
             GROUP BY ID
            ) myTable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im developing an App which is going to be used on Samsung Galaxy SII
Im developing an app which uses the tcp connection. currently im communicating using hard
I am developing an app which will used for trending tracker in twitter. The
So I am developing an app which contains a table view that has images
i got the following problem: I am developing an app which requires the zxing-QR-Code
I am developing an app which extends the auth_user table, whenever any user register
I am developing an app which draws more or less a two-dimensional matrix of
I'm developing an app which uses RapidMiner for classification. I train the classifier time
I'm developing an app which has a large amount of related form data to
I am developing an app which requires the phone to ring or make some

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.