Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Unanswered: Make SQL query think of times until 1am, today

    I currently have a query that includes a which statement that gets times stored in my database which are larger than a time provided by the user (it only checks times, not dates). What I want to do is tell the query any times until 1:00 am is part of today and any times after that are part of tomorrow. So if I have these time values

    09:45 pm
    10:45 pm
    11:45 pm
    00:45 am
    01:45 am
    02:45 am

    And get times > 10:00 pm it currently returns

    10:45 pm
    11:45 pm

    I want it treat any times up until 1:00 am as 'today' and anything after as 'tomorrow' so I want it to return

    10:45 pm
    11:45 pm
    00:45 am

    Is this possible?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Can you provide your current query please?
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2014
    Posts
    2
    SELECT arrival, journey_id, end_stop_id, towards_stop_id FROM journey_view WHERE stop_id = 44 AND towards_stop_id = 46 AND route_colour_id = 1 AND arrival > '17:00' AND end_stop_id != 44 ORDER BY arrival LIMIT 5

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •