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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:44:48+00:00 2026-06-03T18:44:48+00:00

I am running this command in sql select ID, TASK, CreatedBy,CreateDate from John Results

  • 0

I am running this command in sql

select ID, TASK, CreatedBy,CreateDate
from John Results group by ID, TASK, CreatedBy, CreateDate

which is returning this

20  text    user1   2008-11-07 19:10:47.230
20  text    user2   2008-11-07 17:45:17.993
24  text    user3   2008-11-07 18:58:08.727
25  text    user4   2008-11-07 20:19:01.293
36  text    user5   2008-11-10 21:31:23.610
37  text    user6   2008-11-10 21:34:09.597
38  text    user7   2008-11-10 21:35:19.660

There are two ID’s that are 20 and I am trying to get the result with the lowest date so in this example it would be

20  text    user2   2008-11-07 17:45:17.993

How would I go about doing that for all the duplicate ID’s
Thank you very much

  • 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-03T18:44:50+00:00Added an answer on June 3, 2026 at 6:44 pm
        WITH mycte
        (id, createdate, createdby, rownum)
        AS
        (
         SELECT id, createdate,createdby,  ROW_NUMBER() OVER (PARTITION BY id ORDER BY createdate  ASC) AS ROWNUM
         FROM johnresults
        )
    
        SELECT j.id, j.task, mycte.createdby, mycte.createdate 
        FROM
        johnresults j
        inner join mycte ON j.id = mycte.id and mycte.rownum = 1
        GROUP BY j.id, j.task, mycte.createdby, mycte.createdate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am running something similar to this command: Person.sum(:cholesterol, :group => :age) which
I'm running this SELECT statement: TIMEDIFF(NOW(), posts.date_modified) as time_ago And getting results in the
In ZF you create a project by running this command: zf create project MyProjectName
When running this powershell command Get-ChildItem -Recurse -Include *.txt You get multiple tables in
I am getting this weird error while running cucumber test: ERROR Mongo::OperationFailure: Database command
Say suppose I am running a java program through command line. And this program
I have an SQL file which uses declares a cursor and I am running
I'm running a SQL server and need to run some commands using the SELECT
We're running our application's database on dedicated box running only SQL Server 2005. This
I'm running a SQL command in C# that returns one value (a String). I'm

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.