views:

45

answers:

3

hi,

I try to run this query:

select * from WorkTbl
where ((Tdate >= '20100414' AND Ttime >= '06:00')  and (Tdate <= '20100415' AND Ttime <= '06:00'))

I have this date: 14/04/2010 and time: 14:00

I cant see hem, how to fix the query?

Thank's in advance

A: 

Have you tried formatting the date in the where clause like this:

'DD/MM/YYYY'
vfilby
A: 

Your current query will only match rows where Ttime is exactly 06:00 (ie, this is the only time that matches both the >= '06:00' and the <= '06:00 criteria).

Try something like this instead:

SELECT *
FROM WorkTbl
WHERE (Tdate = '20100414' AND Ttime >= '06:00')
    OR (Tdate = '20100415' AND Ttime <= '06:00')
LukeH
A: 
SELECT *
FROM WorkTbl
WHERE (Tdate > '20100414' OR (Tdate == '20100414' AND Ttime >= '06:00'))
  AND (Tdate < '20100415' OR (Tdate == '20100415' AND Ttime <= '06:00'))
Anthony Faull