1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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.
    SEMrush
    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
    SEMrush
  2. JEET

    JEET Notable Member

    Messages:
    3,357
    Likes Received:
    371
    Best Answers:
    16
    Trophy Points:
    235
    #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,357
    Likes Received:
    371
    Best Answers:
    16
    Trophy Points:
    235
    #4
    Good to know, thanks for updating with answer :)
     
    JEET, Jan 7, 2020 IP
Thread Status:
Not open for further replies.