I want to create web page which user will select "previous date" until certain date including their shift(day or night).below are the example.
here i also provide my table P_tracking and my sql
SELECT *
FROM P_Tracking
WHERE (ProductionDate >='2014-04-14'
AND ProductionShift='N')
AND (ProductionDate <= '2014-04-25'
AND ProductionShift = 'D')
my sql query seem didnt work. Can anyone help me solve this. thank you.
I think what you want to do is this:
select * from P_Tracking where
ProductionDate between '2014-04-14' and '2014-04-25'
AND
ProductionShift in ('D','N')
because you both conditions can't be true at the same time, so you will get no results, so you have to use OR
instead of AND
.