how can I make a query with dates? I have an old Access file with the coloumns Date and Time, and I want to use the Between clause. But I even can´t get a query if I chose a specific date or time. The Date data look like yyyy-mm-dd 00:00:00 and the Time data look like 1899 etc.
I tried wildcards, date with time, just date, date with points, date as a variable, defining date as DATE in SQL, cascading SQL, and whatsoever.
Anyone?
select * from db where DATE = '2002-07-06 ...
-
coldarchon
- New User

- Posts: 4
- Joined: Tue Aug 19, 2003 10:34 am
Re: select * from db where DATE = '2002-07-06 ...
You have to use dates like #08/19/2003# (with the leading and trailing #) in Access, if I remember right.coldarchon wrote:how can I make a query with dates? I have an old Access file with the coloumns Date and Time, and I want to use the Between clause. But I even can´t get a query if I chose a specific date or time. The Date data look like yyyy-mm-dd 00:00:00 and the Time data look like 1899 etc.
I tried wildcards, date with time, just date, date with points, date as a variable, defining date as DATE in SQL, cascading SQL, and whatsoever.
Anyone?
-
coldarchon
- New User

- Posts: 4
- Joined: Tue Aug 19, 2003 10:34 am
By using "LIKE '..." you are treating the column as if it was text.coldarchon wrote:nope, doesn´t work for me. But the "Like" option works.
Select * From db Where Date Like '06.07.2002'
No Between ...
Sorry, if I insist - I probably didn't quite catch you - but given a table "dates" that looks like
Code: Select all
id;datefield
0;30.12.2004 12:00:12
1;22.06.2012 14:00:01
2;08.08.1972 08:10:01
3;19.01.2002 07:03:00Code: Select all
SELECT datefield FROM dates WHERE datefield>#1/1/1975# AND datefield<#1/1/2006#;Code: Select all
30.12.2004 12:00:12
19.01.2002 07:03:00And sorry for picking such lousy dates...
-
coldarchon
- New User

- Posts: 4
- Joined: Tue Aug 19, 2003 10:34 am
