Select rows for a specific date using TIMESTAMP datatype

后端 未结 3 397
温柔的废话
温柔的废话 2021-01-27 09:51

I have the tables below in my database:

Student    (Stud_no: string, Stud_name: string)
Membership (Mem_no: string, Stud_no: string)
Book       (book_no: string,         


        
3条回答
  •  逝去的感伤
    2021-01-27 10:27

    Just write you query as:

    AND iss_date >= '2019-08-06'
    AND iss_date <  '2019-08-07'
    

    Or more conveniently:

    AND iss_date >= '2019-08-06'
    AND iss_date <  '2019-08-06' + INTERVAL 1 DAY
    

    While this looks lengthy, it can use indexes more efficiently and very generic.

提交回复
热议问题