I have 2 tables client (client_id,client_name,client_lname)
and orders(Order_Id,Client_Id,Total_Amount,Order_Date,Order_Time,Order_Status).I have to display records between two dates and time.
I have wrote this query :
select o.Order_Id,c.client_name,c.client_lname,o.Total_Amount,o.Order_Date,o.Order_Time from orders as o join client as c on o.Client_id=c.Client_id where (o.Order_Date between '01/01/2013' and '22/01/2013' ) and (o.Order_Time between '17:41:59' and '20:42:04') and o.Order_Status='1' order by o.Order_Id
It works fine..but I wont work in the following case for ex.I want to find records from 01/01/2013 23:12:00 to 22/01/2013 08:05:10 . and if the condition is like 01/01/2013 16:10:04 to 22/01/2013 16:20:04.Help me out .Thanks