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

  • Home
  • SEARCH
  • 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 6129593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:45:40+00:00 2026-05-23T16:45:40+00:00

I have a table with 3 date fields. I am trying to find the

  • 0

I have a table with 3 date fields. I am trying to find the smallest of the three dates in each record.

What I’d like to do is this:

Select id, some_value, date_a, date_b, date_c,
        min(date_a, date_b, date_c) as smallest_date
from some_table;

but this clearly doesn’t work. There is no rule that suggests which date might be larger than others, and sometimes any number of them (none to all) could be NULL. I am sure I’ve seen an elegant solution for this somewhere that didn’t involve lots of ugly case statements and checks for null, but I just can’t seem to remember how to do it.

(Oracle 10g)

  • 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-23T16:45:40+00:00Added an answer on May 23, 2026 at 4:45 pm

    You want the LEAST function:

    SELECT LEAST(date_a, date_b, date_c) as smallest_date
    FROM some_table;
    

    AFAIK, if some could be null, then you’re going to have to use NVL on each column to set a default:

    SELECT LEAST(NVL(date_a,sysdate), NVL(date_b,sysdate), NVL(date_c,sysdate)) as smallest_date
    FROM some_table;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table containing 2 date fields and an identifier (id, fromdate and
I have a table with an associate_id and date fields. I want to get
I have a table with 3 fields: color, fruit, date. I can pick 1
If I have table with a Date column called myDate , with values like
I have a table with 2 'datetime' fields: 'eventDate' and 'eventHour'. I'm trying to
I have tasks table with 3 fields: date priority (0,1,2) done (0,1) What I
I have a large table with input boxes. Three columns of these are dates/times
Hi all I have an appointments table that has among other fields a DATE
I have a table that has several date fields. For example, in the defects
In my table I have two fields: start_date and end_date. I'm just trying 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.