Why date comparison in sql is not working. Please help

Posted by Shantanu Gupta on Stack Overflow See other posts from Stack Overflow or by Shantanu Gupta
Published on 2010-04-22T08:33:17Z Indexed on 2010/04/22 8:43 UTC
Read the original article Hit count: 210

Filed under:
|
|

I am trying to fetch some records from table but when i use OR instead of AND it returns me few records but not in other case. dates given exactly are present in table. What mistake i am doing ?

select newsid,title,detail,hotnews 
from view_newsmaster
where  datefrom>=CONVERT(datetime, '4-22-2010',111) 
  AND dateto<=CONVERT(datetime, '4-22-2010',111)

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-query