Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme 

string time compare

      
            
                
            
 run  | edit  | history  | help 2

drop table splash;

CREATE TABLE splash ( id int, time1 varchar(255), time2 varchar(255) );

INSERT INTO splash (id, time1, time2) VALUES (1, '01:00 pm', '10:00 pm'), (2, '11:00 am', '01:00 pm'), (3, '09:00 am', '11:00 am'), (4, '05:00 pm', '11:59 pm');

select time1, time2 from splash where str_to_date(time1,'%h:%i %p') > str_to_date('12:00 pm','%h:%i %p') or str_to_date(time2,'%h:%i %p') < str_to_date('10:00 am','%h:%i %p') order by 1,2;

  by  LIDIA SUÁREZ, 1 months ago




Please log in to post a comment.