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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:00:26+00:00 2026-06-15T11:00:26+00:00

I always only need the most recent 10 years of data from the result

  • 0

I always only need the most recent 10 years of data from the result set. The years will always have multiple records, so I can not pull only the first 10 records. How can I: SELECT Set 1, SELECT Set 2… through set 10 and only display those 10 years of data without pulling prior years?

Year    Quarter    Quarterly_yield
2012    1         8.41
2012    2        -0.71
2011    3         0.03
2011    4         3.43
2010    1         8.41
2010    2        -0.71
2009    3         0.03
2009    4         3.43
2008    1         8.41
2008    2        -0.71
2007    3         0.03
2007    4         3.43
2006    1         8.41
2006    2        -0.71
2005    3         0.03
2005    4         3.43
2004    1         8.41
2004    2        -0.71
2003    3         0.03
2003    4         3.43
2002    1         8.41
2002    2        -0.71
2001    3         0.03
2001    4         3.43
2000    1         8.41
2000    2        -0.71
  • 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-15T11:00:27+00:00Added an answer on June 15, 2026 at 11:00 am

    You can do this this way:

    SELECT * FROM table WHERE year IN 
                         (SELECT year FROM table ORDER BY year DESC LIMIT 10); 
    

    This query can explained like this:

    1. Inner query – select last 10 years from table
    2. Outer query – select all columns from table where year in inner query result
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table called pollData. It will always contain only 1 row. It
I have multiple messages in SQS. The following code always returns only one, even
I need to query data from a second table, but only if a rare
string format is always like this FirstName=ABC;LastName=XZY;Username=User1;Password=1234. I need the only UserName value (which
I have print $str; abcd*%1234$sdfsd..#d The string would always have only one continuous stretch
I always thought that LIMIT in a query selects only between numbers I set.
I have a need to return a specific number of rows from a query
I've always relied on my PHP programming for most processes which I need to
Possible Duplicate: Delete all but the most recent X files in bash I have
Im writing a report with Reporting services that is almost always only going to

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.