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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:14:48+00:00 2026-05-26T22:14:48+00:00

Working on a SQL query here, I have an ID column that I created

  • 0

Working on a SQL query here, I have an ID column that I created and I want to be able to take the max ID number and show the 12 behind it. See picture. I want to show Row 20-8 and everything above 8, dismiss. Can someone help me with an orderby or between statement?

Thanks

enter image description here

my sql query:

SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY FiscalYear, FiscalMonth) as ID,FiscalYear, FiscalMonth, SUM(STDCOST) AS STDCost, Concat
FROM dbo.[13568]
GROUP BY FiscalYear, FiscalMonth, Concat
ORDER BY FiscalYear, FiscalMonth

  • 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-26T22:14:48+00:00Added an answer on May 26, 2026 at 10:14 pm

    Am I missing something?

    SELECT * FROM (
        SELECT TOP 13 ROW_NUMBER() OVER (ORDER BY FiscalYear, FiscalMonth) as ID
            ,FiscalYear
            ,FiscalMonth
            ,SUM(STDCOST) AS STDCost
            ,Concat
        FROM dbo.[13568]
        GROUP BY FiscalYear, FiscalMonth, Concat
        ORDER BY FiscalYear DESC, FiscalMonth DESC
    ) AS X
    ORDER BY FiscalYear, FiscalMonth
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Linq to SQL query that was working just fine with SQL
I am working on a SQL query that reads from a SQLServer database to
I have SQL query, which is working nice on Oracle and MSSQL. Now I'm
I'm working on creating a SQL query that will pull records from a table
I am working on .aspx page that uses a t-sql query that uses a
I am working with a LINQ to SQL query and have run into an
I have an ObjectQuery like that: ObjectQuery<Car> query = GetCarQuery(); than i want to
I have a SQL query and here it is the part I'm stuck on.
I have a really weird issue with an SQL query I've been working with
I am stuck figuring out a working SQL Query for the fallowing: I need

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.