Simple query

A

an

I have:

SELECT Table1.Param, Table1.Date, Table1.Val, *
FROM Table1
WHERE (((Table1.Date) Like "??*" & [Choose number month]
& "??*"));

The date has Medium Date format in Table1 and Query.
(01-Jan-04)
The query work fine, except to month 2.
Why?

I would like to have possibility to choose year too.
How, please

Thanks in advance.
an
 
J

John Spencer (MVP)

Like really doesn't work very well with dates or numbers, because it is designed
to work with text. I would suggest that the easiest solution (not the most
efficient) would be to use the Month and Year functions.

SELECT Table1.*
FROM Table1
WHERE Month(Table1.[Date])= [Enter number month] AND
Year(Table1.[Date])= [Enter Year as 4 digits]
 
A

an

Exactly!
Many thanks for your help.
Have you a good weekend.
an
-----Original Message-----
Like really doesn't work very well with dates or numbers, because it is designed
to work with text. I would suggest that the easiest solution (not the most
efficient) would be to use the Month and Year functions.

SELECT Table1.*
FROM Table1
WHERE Month(Table1.[Date])= [Enter number month] AND
Year(Table1.[Date])= [Enter Year as 4 digits]


I have:

SELECT Table1.Param, Table1.Date, Table1.Val, *
FROM Table1
WHERE (((Table1.Date) Like "??*" & [Choose number month]
& "??*"));

The date has Medium Date format in Table1 and Query.
(01-Jan-04)
The query work fine, except to month 2.
Why?

I would like to have possibility to choose year too.
How, please

Thanks in advance.
an
.
 

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

Similar Threads


Top