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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:44:01+00:00 2026-05-18T10:44:01+00:00

I am faced with getting the latest (newest) record for a part, and my

  • 0

I am faced with getting the latest (newest) record for a part, and my only way is to do it using a “max date” approach.

Here is a basic schema (and sample data):

ldDate                  ldTime  ldPart          id
2010-10-26 00:00:00.000 52867   90-R6600-4100   186
2010-11-01 00:00:00.000 24634   90-R6600-4100   187
2010-11-24 00:00:00.000 58785   90-R6600-4100   194
2010-11-24 00:00:00.000 58771   90-R6600-4100   195
2010-11-17 00:00:00.000 29588   90-R6600-4100   201
2010-11-08 00:00:00.000 29196   90-R6600-4100   282
2010-11-08 00:00:00.000 29640   90-R6600-4100   290
2010-10-19 00:00:00.000 58695   90-R6600-4100   350
2010-09-22 00:00:00.000 32742   BH4354-F0       338
2010-09-22 00:00:00.000 32504   BH4354-F0       340
2010-11-17 00:00:00.000 31157   BH4354-F0       206
2010-11-08 00:00:00.000 27601   BH4354-F0       218
2010-11-08 00:00:00.000 27865   BH4354-F0       21
2010-09-22 00:00:00.000 23264   BR6950-F0       70
2010-09-22 00:00:00.000 23270   BR6950-F0       77
2010-09-24 00:00:00.000 27781   BR6950-F0       97
2010-11-24 00:00:00.000 57735   BR6950-F0       196

What I have above is an ldDate with no time, and an ldTime but not a proper HH:MM:SS representation, it is seconds since midnight, so the first line would be:

2010-10-26 00:00:00.000 52867
or if I convert the time:

52 867 seconds = 14.6852778 hours
~2010-10-26 14:68:52

Is there a clean way I can combine both columns in my SQL query? I want to do a simple max(ldCombinedDate) and group by ldPart (part number).

The id, is almost useless, so ignore it, it is there right now for what order a record was inserted, nothing else, could be used for a nested query maybe? NOTE: Order of entry does not mean latest date…

Thanks…

  • 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-18T10:44:02+00:00Added an answer on May 18, 2026 at 10:44 am

    The expression

    DATEADD(second, ldTime, ldDate)
    

    will return the combined date. So, I guess you want something like this:

    SELECT ldPart, MAX(DATEADD(second, ldTime, ldDate)) AS MaxCombinedDate
      FROM yourtable
     GROUP BY ldPart
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I faced a problem while using threading for the first time, In an SWT
I faced up with a strange scala-io moveTo method issue. Here is my filesystem,
I faced the following issue while I submitting my form using jQuery FORM and
I am faced with getting a rather complex web app to work in HTML/CSS.
Today I faced an error due to which my Android application is getting by
My threads are getting locked while calling new URL(url).openConnection(); A part of thread dump
During the process of testing my Perl code using Smart Match(~~) I have faced
in my project i've faced a problem getting values of css attributes in wicket
I've faced a strange issue with session across subdomain only for google chrome. I
I want to have a way of getting a view to focus on a

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.