select data from range of two column mysql -


while this shows between 2 dates, want make selects data has "2013-11-28".

id   check_in               check_out 1    2013-11-01             2013-12-01 2    2014-01-01             2014-01-07 3    2013 11-20             2014-01-03 

so when select "2013-11-28", select id '1' , '3'.

if want records check_in's year 2013 , month 11, can try this:

select *  yourtable  year(check_in) = '2013' , month(check_in) = '11'; 

demo here

if want records check_in before 2013-11-28 , check_out after 2013-11-28, can try:

select *  yourtable  check_in <= '2013-11-28' , check_out >= '2013-11-28'; 

demo here


Comments