Hi
I have datetime field Order_Date in MYSQl table (2008-11-11 13:23:44.657)
I have 1 variable in which date is stored in dd-MM-yyyy format
I want to write a sql statement (select * from table1 where order_date = variable . How i write this statement comparing the dates . I am using MySql.
Thanks
Query
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Prabhu RajaRank #861 · 2.6K reputationPosted Sep 5, 2011, 3:06 AM EDT
Select count(*) from table where LEFT(CONVERT(datetime, order_date , 120), 10) = yourvariable;
-----------------------------------
if this post helps you. Mark this as "Correct answer"
Jagjit Saini166 reputationPosted Sep 5, 2011, 3:23 AM EDT
i have done this & it's working
Select count(*) from hs_hr_attendance where convert(order_time,DATE) = '" + _dt.ToString("yyyy-MM-dd")
Thanks