php - Why do i get this result? -
select * afspraken user_id = '2' , datum > '2012-06-05' or ( user_id = '2' , datum = '2012-06-05' , begintijd >= '22:47' ) order datum desc , begintijd asc
this above query.. , while should 0 result still 1 is:
id user_id datum begintijd opmerking 114 2 2012-06-05 9:30 deze afspraak online gemaakt.
now if have correctly, query has 2 options give results.. is: user_id must same , date has higher 2012-06-05.. since same date won't give result..
now second option when user_id same, date same , when beginningtime same or higher.. time in query shown 22:47.. time in database 9:30 morning.. how 9:30 morning higher or equal 22:47??
id int(10) user_id int(10) datum date begintijd varchar(5) opmerking varchar(8000) reminder int(10)
the idea cast time columns , values time:
select cast('20:05' time) > cast('9:06' time) #returns 1 (compares times - want) select '20:05' > '9:06' #returns 0 (compares strings - not want)
read more here.
Comments
Post a Comment