Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2014
    Posts
    2

    Angry Unanswered: How to compare date times in a where clause

    How do you express the following correctly?

    select * from event where current year to minute - date_locked > 20 minutes

    date_locked is a date time year to minute column in the event table. How do I express 20 minutes on the rhs?

  2. #2
    Join Date
    Nov 2014
    Posts
    2

    Solution?

    Quote Originally Posted by donpwinston View Post
    How do you express the following correctly?

    select * from event where current year to minute - date_locked > 20 minutes

    date_locked is a date time year to minute column in the event table. How do I express 20 minutes on the rhs?
    The following appears to work:

    SELECT * FROM EVENT WHERE CURRENT YEAR TO MINUTE - date_locked > INTERVAL(20) MINUTE TO MINUTE;

Tags for this Thread

Posting Permissions

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