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

  • Home
  • SEARCH
  • 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 5959377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:40:34+00:00 2026-05-22T18:40:34+00:00

I used ROW_NUM() function for paging in ASP.NET SELECT row_num, expense_id,email, reason, amount,date,category_name,is_income FROM

  • 0

I used ROW_NUM() function for paging in ASP.NET

SELECT row_num, expense_id,email, reason, amount,date,category_name,is_income
FROM
  (
  SELECT e.expense_id,e.email, e.reason, e.amount,e.date,c.category_name,e.is_income, 
  ROW_NUMBER() OVER(ORDER BY e.date DESC,e.expense_id) as row_num
  FROM Expense e
  JOIN Category c ON e.category_id = c.category_id
  WHERE e.date >='5-1-2011' AND e.date<='5-31-2011'
  ) as ExpenseInfo
WHERE email='sample@domain.com'

But it returned an inconsistent list of row_num (such as 1,3,4… or 2,3,4…). How can I solve this problem?

Thanks in advance.

I have solved my problem

SELECT RowNum, expense_id, email, reason, amount, date, category_name, is_income
FROM
(
SELECT e.expense_id, e.email, e.reason, e.amount, e.date, c.category_name, e.is_income, Row_Number() OVER(ORDER BY date DESC) as row_num 
FROM Expense e JOIN Category c 
  ON e.category_id = c.category_id
WHERE e.date >='5-1-2011' AND e.date<='5-31-2011' AND e.email='sample@domain.com'
) AS ExpenseInfo
WHERE row_num>=1 and row_num<=20
  • 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-05-22T18:40:35+00:00Added an answer on May 22, 2026 at 6:40 pm

    The Where email = 'sample@domain.com' is filtering out certain rows. For what you are doing here, you don’t need the “outer” query. Just wrap it all together.

     SELECT ROW_NUMBER() OVER(ORDER BY e.date DESC, e.expense_id) as row_num
           , e.expense_id
           , e.email
           , e.reason
           , e.amount
           , e.date
           , c.category_name
           , e.is_income
      FROM Expense e
      JOIN Category c 
        ON e.category_id = c.category_id
      WHERE e.date >='5-1-2011' 
        AND e.date <='5-31-2011'
        AND e.email = 'sample@domain.com'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone happen to remember the function name used to generate sequential row number
I have a function that is used as an INSERT trigger. This function deletes
I have written this code and in this the function gen() id used to
i used this link to build a basic jqgrid: http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx this my code: <script
I am using jqgrid treeview with an asp.net-mvc backend and i see the GUI
http://scienceoss.com/read-excel-files-from-python/comment-page-1/#comment-1051 From the above link, I used this utility to read an XLS file.
I had used the below code to get the row index of the UIPickerView
I have a problem with ROW_NUMBER() , if i used it with DISTINCT in
The Cassandra command-line utility sstablekeys can be used to extract all defined row keys
I am trying to show detailed UItable view when clicking on row. I used

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.