sql - MySQL - Return Row Where Current Date Between Start and End Date -


i have searched everywhere , can't find answer this.

the table below shows class start , end time.

i looking return row current time falls in-between current start , end time.

the start , end time going variable dependent on current time, can't input specific values.

mysql table showing class id, start , end time

an exmaple being, if current time is:

2016-02-05 20:15:00

then return row class id 6.

select * table  class_start_timestamp > getdate() , class_end_timestamp < getdate() 

if columns not datetime:

select * table  cast(class_start_timestamp datetime) > getdate() , cast(class_end_timestamp datetime) < getdate() 

you can use "now()" (mysql) , "between", quick google should have yielded many options...


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -