views:

24

answers:

1

retrieve next 24 hours details from the table

i read one thread, same question here

link text

but small diff is , my field name is jdate is the varachar, but they are used the datetime data type format,

+1  A: 

use str_to_date before :)

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

so the sql like :

WHERE STR_TO_DATE(my_field,'myformat') > DATE_SUB( NOW(), INTERVAL 24 HOUR)
Haim Evgi
Sorry , this same query for sql also or somthing diff
Bharanikumar
its for mysql :)
Haim Evgi
i appalogies, i have two database, one is sql and mysql, so i need for mssql also
Bharanikumar
for mssql use convert function like : http://www.mssqltips.com/tip.asp?tip=1145
Haim Evgi