Get the nearest SQL records.



  • Good afternoon. There are records of the type of date. begin_registration and end_registration type timestamp. This is the registration period for the seminar. How to get all the records on which the registration is open. I mean. On 06 June 2016, and beginning of registration from 05 June 2016 until 21 June 2016 How is SQL gonna be right?



  • In postgresql

    SELECT *
    FROM   tbl
    WHERE (begin_registration, end_registration) OVERLAPS ('2016-06-05':DATE, '2016-06-21'::DATE);
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2