MS Query: filtering data using date fields

R

Raminhos

Hi,

Firstly, let me say I don't know how to code. My question is this.

I'm using Excel to query a Lotus Notes Database. I use Microsoft Query to do
it and it works just fine when simply retrieving data.

What I want to do is simply return data based on dates. I want records to be
returned between the current system date and the current system date minus 8
days.

E.g. Return all records between
(1) current system date 04/02/2005 and
(2) current system date 04/02/2005 MINUS 8 days
Expected result would be all records that have a date from and including
04/02/2005 and 27/01/2005

The SQL code that shows up in Microsoft query using the Wizard is this:
SELECT Copy_Of_Closed_."_8"
FROM Copy_Of_Closed_ Copy_Of_Closed_
WHERE (Copy_Of_Closed_.Priority='0 - Critical') AND
(Copy_Of_Closed_.CallType='P') AND (Copy_Of_Closed_.Status='Closed')

This is without the date filtering. As for the " " around the 8 (i.e.
Copy_Of_Closed_."_8"), I'm not sure why it does that, but it works!

I'd really appreciate any help with this and this little tiny piece of code
is stopping me from doing something really really simple!

Many thanks in advance.

Lena Gallagher
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UmFtaW5ob3M=?=,
Firstly, let me say I don't know how to code. My question is this.

I'm using Excel to query a Lotus Notes Database. I use Microsoft Query to do
it and it works just fine when simply retrieving data.
I suggest, in this case, that you post to the appropriate EXCEL newsgroup.
You're more likely to encounter someone there familiar with MS Query and the
SQL syntax it uses.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
D

Dude

Hello Raminhos,

SQL authorised statements may vary from one databse engine to another. I'm
not sure of what Lotus Notes accepts, but assuming that "DATE" is the date
field of your Lotus Notes database, you may try the following SQL statement
:

SELECT Copy_Of_Closed_."_8"

FROM Copy_Of_Closed_ Copy_Of_Closed_

WHERE (Copy_Of_Closed_.Priority='0 - Critical') AND

Copy_Of_Closed_.CallType='P') AND

(Copy_Of_Closed_.Status='Closed') AND

(to_days(CURDATE())-to_days(Copy_Of_Closed_.DATE))<=8

have a nice day
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top