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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:04:52+00:00 2026-05-30T03:04:52+00:00

For the query: SELECT MAX(LOG_CREATION_DATE),COL_A, COL_B FROM IMPORT_LOG GROUP BY TO_CHAR(LOG_CREATION_DATE, ‘MM-DD-YYYY’), COL_A, COL_B

  • 0

For the query:

SELECT MAX(LOG_CREATION_DATE),COL_A, COL_B
FROM IMPORT_LOG
GROUP BY TO_CHAR(LOG_CREATION_DATE, 'MM-DD-YYYY'),
              COL_A,
              COL_B
ORDER BY  MAX(LOG_CREATION_DATE)  DESC
              ;

the records are in descending order as needed:

09-FEB-12 12.59.18.000000000 PM
09-FEB-12 12.41.42.000000000 PM
09-FEB-12 11.26.15.000000000 AM
09-FEB-12 11.26.00.000000000 AM
01-FEB-12 01.27.11.000000000 PM
01-FEB-12 01.25.18.000000000 PM
01-FEB-12 01.25.17.000000000 PM
01-FEB-12 01.24.36.000000000 PM
25-JAN-12 02.39.11.000000000 PM
25-JAN-12 02.32.05.000000000 PM
25-JAN-12 02.31.37.000000000 PM
25-JAN-12 02.31.34.000000000 PM

But when I change the query to format the same timestamp column, the order completely changes to:

02-09-2012 12:02:18
02-09-2012 12:02:42
02-09-2012 11:02:15
02-09-2012 11:02:00
02-01-2012 01:02:11
02-01-2012 01:02:18
02-01-2012 01:02:17
02-01-2012 01:02:36
01-25-2012 02:01:11
01-25-2012 02:01:05
01-25-2012 02:01:37
01-25-2012 02:01:34

the updated query is

SELECT TO_CHAR(MAX(LOG_CREATION_DATE), 'MM-DD-YYYY HH:MM:SS'),COL_A, COL_B
FROM IMPORT_LOG
GROUP BY TO_CHAR(LOG_CREATION_DATE, 'MM-DD-YYYY'),
              COL_A,
              COL_B
ORDER BY  MAX(LOG_CREATION_DATE)  DESC
              ;

why is the output changed ?

  • 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-30T03:04:53+00:00Added an answer on May 30, 2026 at 3:04 am

    Your date format mask is wrong, you have the time part as HH:MM:SS when you should have HH:MI:SS. Or even better possibly, HH24:MI:SS.

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

Sidebar

Related Questions

Why query: SELECT id, MAX(probe_time) AS Expr1 FROM app_states GROUP BY logon_id and SELECT
why is this query giving weird results.. SELECT max(greatest(home_team_total,away_team_total)) AS max_team_score, id FROM `match`
When I execute this query: Dim Var Var = ("select max(Autonumber) from tblAutonumber") DoCmd.RunSQL
I have a query that looks a bit like this: SELECT weekEnd, MAX(timeMonday) FROM
I have this query which groups the results by ORDER#. SELECT ORDER#, MAX(SHIPDATE -
I have the following query: SELECT (RAND() * (SELECT MAX(id) FROM frag.test)) Results in:
I want to select max Id from nested select. Here is the my query:
Query: select max(b.counter) as counter, b.m_group, b.m_code, a.s_id, s.id_sk from tbl_various a, tbl_map b,
The Query: SELECT max(image_url), Model_Name FROM ( SELECT max(image_url), Model_Name FROM dbo.proinfo_vodafone WHERE Brand_name='Nokia'
I'm trying to run the following query: SELECT formatted_journeys.*, MAX(speed) FROM formatted_journeys JOIN tracker.g_log

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.