473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Date driven data display

My client has an annual calendar of events consisting of a record for each
event, key field is the event date saved as a date type field. They would
like the display to start with the current month, list to the end of the
year then start the beginning of the year and list up to the current month.
How does one retrieve data based on date? I guess I'd like something like :

SELECT * FROM EVENTS WHERE [month is greater than or equal to the current
month] ORDER BY Date

Then :

SELECT * FROM EVENTS WHERE [month is less than the current month] ORDER BY
Date

What is the syntax for the month bits between the []?

Thanks!
Jul 19 '05 #1
2 3359
On Fri, 17 Oct 2003 00:14:17 GMT, "Simon Wigzell"
<si**********@shaw.ca> wrote:
My client has an annual calendar of events consisting of a record for each
event, key field is the event date saved as a date type field. They would
like the display to start with the current month, list to the end of the
year then start the beginning of the year and list up to the current month.
How does one retrieve data based on date? I guess I'd like something like :

SELECT * FROM EVENTS WHERE [month is greater than or equal to the current
month] ORDER BY Date

Then :

SELECT * FROM EVENTS WHERE [month is less than the current month] ORDER BY
Date

What is the syntax for the month bits between the []?

Thanks!


Hints:
The first day of the current month is:
DateSerial(year(now), month(now), 1)

The last day of the previous month one year from now is:
DateSerial(year(now) + 1, month(now) , 0)

SELECT * FROM EVENTS WHERE
EventDate >= 'FirstOfCurrentMonth'
AND
EventDate <= 'LastOfPrevMonthPlus1Year'
ORDER BY EventDate

Another suggestion... Do not name a field "Date".

Jul 19 '05 #2

"Dan Brussee" <db******@NOSPAMnc.rr.com> wrote in message
news:kd********************************@4ax.com...
On Fri, 17 Oct 2003 00:14:17 GMT, "Simon Wigzell"
<si**********@shaw.ca> wrote:
My client has an annual calendar of events consisting of a record for eachevent, key field is the event date saved as a date type field. They would
like the display to start with the current month, list to the end of the
year then start the beginning of the year and list up to the current month.How does one retrieve data based on date? I guess I'd like something like :
SELECT * FROM EVENTS WHERE [month is greater than or equal to the current
month] ORDER BY Date

Then :

SELECT * FROM EVENTS WHERE [month is less than the current month] ORDER BYDate

What is the syntax for the month bits between the []?

Thanks!


Hints:
The first day of the current month is:
DateSerial(year(now), month(now), 1)

The last day of the previous month one year from now is:
DateSerial(year(now) + 1, month(now) , 0)

SELECT * FROM EVENTS WHERE
EventDate >= 'FirstOfCurrentMonth'
AND
EventDate <= 'LastOfPrevMonthPlus1Year'
ORDER BY EventDate

Another suggestion... Do not name a field "Date".

Thanks, I'll try that, and "Date" was just for the example, thanks.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: End Around | last post by:
I am creating a time-based art web site that will show a different html page depending on the client side local date. I also prefer that the top page doesn't literally redirect to, say 7.htm for...
1
by: Paul | last post by:
Is there a way in Access to convert a date in format "mdy - 08/05/2005" to "ymd - 2005-08-05" using an update query?
3
by: Tom | last post by:
In a JET db using ACCESS, I specify a field Data Type as Date/Time and the Format as Short Date. These dates appear as 1/3/2003, 3/31/2003 ..... in Access which is fine since I don't want the time....
6
by: yoshitha | last post by:
hi db : sql server 2000 lan : C#.net(ASp.Net) in my database table there are 2 fileds of data type datatime. in field 1 i'm storing date in field 2 i'm storing time.
2
by: x | last post by:
hi i am a pilot by profession. i want to create a database of my logbook using ms access 2002. i am facing a problem regarding the format of time field. when i select "Data/Time" data type for my...
0
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example :...
0
by: diff | last post by:
I am having trouble preventing a bound source from updating using event-driven validation. There is a very nice article on MSDN explaining this;...
25
by: pereges | last post by:
Hello, I'm trying to build a database driven website for a library management system. The database is stored on a remote server which all of my team mates can access. I've installed MySQL, PHP and...
13
by: chromis | last post by:
Hi, I have a query which updates the projects table of my database, however when I try to run my query with blank values i get the following error: Data truncation: Data truncated for column...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.