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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:34:03+00:00 2026-05-23T15:34:03+00:00

Both dates are stored in one table. If date1 is greater, I want to

  • 0

Both dates are stored in one table. If date1 is greater, I want to return date1, if date2 is greater I want to return date2. I want them to be part of larger query so I would like one main query but if that is not possible, I can use a temp table and use a second query afterward. The code will be executed in a stored procedure.

  • 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-23T15:34:04+00:00Added an answer on May 23, 2026 at 3:34 pm

    It’ll be a CASE statement in standard SQL

    CASE WHEN date1 >= date2 THEN date1 ELSE date2 END
    

    There are specific functions on some RDBMS that will do it like Excel does Max but this is standard…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want compare two dates one would be the current date and other date
I have the following regex which validates dates: //are not both dates if (!methods._isDate(first[0].value)
I have two dates in format(MM/dd/yyyy hh:mm:ss:SS). For the both dates I have converted
I have two dates namely the filecreation date and the system date both in
as far as I know both 2012-07-04T17:30:52+00:00 and 2012-07-04T17:30:52Z are dates in iso8601 format
Similar to Insert into a temp table from a stored procedure on Sql Server
I am joining against a view, in a stored procedure to try and return
I want to implement following logic in my SQL query: If some date is
I have a query that unfortunately has to compare 2 timestamps. One timestamp is
When working in Access, whenever I delete a record from one table - it's

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.