SQL Where Using Date For Attributes With Date & Time

A

Adam Potter

So I have an attribute in a table which contains a date and time (date / time
something was sent). Then in a SQL query I need to pull out everything
between one date and another. I know about the switching to dd/mm/yyyy in the
SQL query.

I've tried all sorts of ways including adding the time of 00:00:00 to the
start date and 23:59:59 to the end date of the range but no luck.

Can someone tell how you would do this in the SQL Where statement please
that I'm building in my VBA code.
 
P

Piet Linden

So I have an attribute in a table which contains a date and time (date / time
something was sent). Then in a SQL query I need to pull out everything
between one date and another. I know about the switching to dd/mm/yyyy inthe
SQL query.

I've tried all sorts of ways including adding the time of 00:00:00 to the
start date and 23:59:59 to the end date of the range but no luck.

Can someone tell how you would do this in the SQL Where statement please
that I'm building in my VBA code.


SELECT ...
FROM MyTable
WHERE [eventdate]>=#1/1/2009# AND [eventdate]<=Date+1;
 

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