SQl Query for Dates

lokeshsu

Board Regular
Joined
Mar 11, 2010
Messages
178
Hi all,

I have created the query for getting a data between dates in access, but when i see the result it takes the start date but excludes the end date. for example if i want the data from 1st Jan 11 till 31st Jan 11 i will get the data from 1st Jan 11 till 30th Jan 11. so i need a query which should include the last date and the first day data.


thanks in advance
Lokesh Sundar
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
i tried that in access but this excludes #01/31/2011# and gives the output only till #01/30/2011#.
 
Upvote 0
then you don't have any data for 1/31

between is inclusive, it includes data for the start date, the end date and all dates inbetween
 
Upvote 0
Also be cognizant that date fields in Access also have time components. Change the format on your Access fields to show the time piece along with the data. If the time piece isn't all zeroes, you may need to modify your criteria to account for this.

#01/31/2011# assumes midnight and is equivalent to #01/31/2011 12:00:00 AM#

If you have a datetime value like this, #01/31/2011 1:00:00 AM#, it will fall outside of your paremters. So you might need to use something like:
#01/31/2011 11:59:59 PM# as you upper bound instead.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,722
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top