Rounddown DateTime to just Date in the ORDER BY Query

Discussion in 'Databases' started by fullylucky, Jan 6, 2020.

Thread Status:
Not open for further replies.
  1. #1
    Hi I need help.

    In the current datebase, one field (column) is datetime. It has both date and time component.
    Column A. Column B is another column.

    I would like to use ORDER BY date and then by column B.

    So like this:

    SELECT *
    FROM TABLE
    ORDER BY ROUNDDOWN(A) DESC, B

    where rounddown rounds A to just a date not datetime.
     
    Solved! View solution.
    fullylucky, Jan 6, 2020 IP
  2. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #2
    JEET, Jan 7, 2020 IP
  3. #3
    hey JEET thanks i have figured it out. I just use DATE() in the order by and it works.

    Thread Closed.
     
    fullylucky, Jan 7, 2020 IP
    sarahk and JEET like this.
  4. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #4
    Good to know, thanks for updating with answer :)
     
    JEET, Jan 7, 2020 IP
Thread Status:
Not open for further replies.