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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:54:31+00:00 2026-05-23T09:54:31+00:00

i have a table with jobs like this in a MS SQL Server 2008

  • 0

i have a table with jobs like this in a MS SQL Server 2008 database:

J_ID      J_Name       J_ReadDate                  J_I_ID
`````````````````````````````````````````````````````````
01        Job1        2011-06-26 01:00:12.153      1
02        Job2        2011-06-25 01:00:07.103      1
03        Job3        2011-06-25 01:00:07.103      2
04        Job4        2011-06-25 01:00:07.103      3
05        Job1        2011-06-26 01:00:07.103      1
06        Job2        2011-06-26 01:00:08.103      2
07        Job1        2011-06-26 01:00:08.103      2

now i want to select only the newest jobs, no matter how old the entry is. So in my example it would like to get this result (ordered by J_ReadDate DESC):

J_ID      J_Name       J_ReadDate                  J_I_ID
`````````````````````````````````````````````````````````
06        Job2        2011-06-26 01:00:08.103      2
07        Job1        2011-06-26 01:00:08.103      2
05        Job1        2011-06-26 01:00:07.103      1
03        Job3        2011-06-25 01:00:07.103      2
04        Job4        2011-06-25 01:00:07.103      3

how can I achieve this? I cannot say, that the time difference between the entries is always one day.

  • 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-23T09:54:32+00:00Added an answer on May 23, 2026 at 9:54 am

    The below will get what you’re after.

    SELECT J_ID, J_Name, J_ReadDate, J_I_ID
    FROM (
      SELECT J_ID, J_Name, J_ReadDate, J_I_ID,
             ROW_NUMBER() OVER (PARTITION BY J_Name ORDER BY J_ReadDate DESC) AS RN
      FROM jobs
    ) J
    WHERE J.RN = 1
    ORDER BY J_ReadDate DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a table structure that looks something like this(some details omitted): ColumnName
I have a SQL Server database running in Full recovery. I need to remove
I have a question about why some SQL (running on SQL Server 2005) is
I have this syntax for grabbing some data from database, I using codeigniter's active
I have a job table that holds jobs and leaddate is the field for
OK. I've read things here and there about SQL Server heaps, but nothing too
I have a number of stored procs which I would like to all run
I have a view that has a list of jobs in it, with data
Here's the situation. Due to the design of the database I have to work
Say I have a Queue table and a Job table. In the Job table

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.