Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 greater and equal operator.

Author  Topic 

lsy
Yak Posting Veteran

57 Posts

Posted - 2007-04-04 : 00:35:08
i would like to query record greater or equal by specific date. my statement as below
SELECT [Start_Date], [End_Date] FROM LogPerformance WHERE [Engineering_Time] = 'No' AND [End_date] <> NULL AND [Start_Date] <= #04/04/2006#
but result it just show record until 04/02/2006 how can i modify the statement in order i able to get the record including 04/04/2006

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 00:39:39
< #05/04/2006


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 00:48:25
quote:
Originally posted by Peso

< #05/04/2006


Peter Larsson
Helsingborg, Sweden


< #05/04/2006#


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 00:55:28


If the current datetime format is DMY.
If it is MDY use

< #04/05/2006#


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 01:00:46
No confusion if you use

< #2006/04/05#



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

lsy
Yak Posting Veteran

57 Posts

Posted - 2007-04-04 : 02:09:54
is it i written there >= wrong??
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 03:18:53
quote:
Originally posted by lsy

is it i written there >= wrong??

Are you asking if >=date is wrong usage?
http://sql-server-performance.com/fk_datetime.asp is for sql server where you can simulate the same in ACCESS

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

lsy
Yak Posting Veteran

57 Posts

Posted - 2007-04-04 : 03:51:09
but how come it is not woring over Access?? it just serve the same like > operator
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 04:49:36
It depends. Since you are new to SQL I can anticipate that your dates in column [Start_Date] are stored as TEXT.
They should be stored as DATE/TIME.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-04-04 : 08:17:37
The problem appears to be that you have data not at 4/4/2006 exactly, but rather at 4/4/2006 at different times. Remember that 4/4/2006 means "4/4/2006 at 12:00:00 AM". So, if you take a value such as "4/2/2006 5:00 PM", you will see that it is not less than or equal to "4/4/2006 12:00:00AM", thus the value is not returned, nor are any other values on 4/4/2006 at any time other than 12:00:00AM. That is why you need to add 1 day and do less than, as Peso initially described.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -