Solved

Find all rows based on day of week

Posted on 2011-03-23
5
675 Views
Last Modified: 2012-05-11
I am importing an appointment schedule from an old software into a new one.  I have a situation where I need to seperate out some appointments.  Is there any way I can query the appointments table and say something like this:

SELECT * FROM Appointments WHERE DATE is a Tuesday?

This way I'll get all appointments that were scheduled on a Tuesday.  And I'll need to do the same for other weekdays as well.

NOTE:  I can pull this table into SQL Server 2008 if that makes querying easier.
NOTE:  All dates are in the year 2011.

JamesNT
0
Comment
Question by:JamesNT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35198163
in access, you can use

format(Date(),"dddd")="Thursday"

or

weekday(Date())=5

0
 
LVL 3

Expert Comment

by:Thomas_Roes
ID: 35198204
There is a function: (my date-field is called 'dag')

Weekday([dag])

You can filter on this.

Thomas Roes
0
 
LVL 18

Accepted Solution

by:
p912s earned 500 total points
ID: 35198253
Your complete SQL string would be like this.

SELECT * FROM Appointments WHERE ((Weekday([YOURDATEFIELDHERE])="3"));

0
 
LVL 44

Expert Comment

by:GRayL
ID: 35199944
3 above should not be in quotes
0
 
LVL 18

Expert Comment

by:p912s
ID: 35202332
Thanks for the grade and points!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question