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

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -