sql - Select * from table where date selected is between -
i trying build following query select * table mindate 03-02-2014 , maxdate 01-03-2014
but missing.
hope can me this.
select * table  substring(mydate, 1, 10) >= replace('03-02-2014','-','/') ,  substring(mydate, 1, 10) <= replace('01-03-2014','-','/')   note: date column of type varchar value --> 03/02/2014 18:13:16
im working in sql server management studio (t-sql)
from comments, seems mydate column of table in british format.
 read this article date conversion in sql server understand more date conversions.
 updated answer date conversions format. 
try
select * table  convert(date, substring(mydate, 1, 10), 103) >= convert(date, '03/02/2014', 103)     , convert(date, substring(mydate, 1, 10), 103) <= convert(date, '01/03/2014', 103)      
Comments
Post a Comment