Fuga
04-21-2002, 02:05 PM
How do I make a query return "only mondays" or only tuesday.
Is there perhaps a better way to do this than in a query?
Fuga.
Is there perhaps a better way to do this than in a query?
Fuga.
|
View Full Version : statement for querying out mondays or tuesdays. Fuga 04-21-2002, 02:05 PM How do I make a query return "only mondays" or only tuesday. Is there perhaps a better way to do this than in a query? Fuga. clive2002 04-21-2002, 04:42 PM you can type 'monday' in the query critera under the column in which monday would appear or 'is like "*monday*" if the word monday appears as part of a sentence. or is like "*[Please enter day for query]*" to have the user enter a specific day each time the query is run. or you could filter the query results by pressing the filter button and setting enter the day in the relevant column. but the query criteria method is probably the best way forward. Pat Hartman 04-21-2002, 06:18 PM If you are comparing against a normal date/time field, you will need to use the Format() function to extract just the day part of the date: Select ... From YourTable Where Format(YourDate,"dddd") = "Monday"; raskew 04-22-2002, 01:25 AM If you're interested in returning specific weekdays, you can also use the WeekDay() function, combined with the InStr() function. For example, to return Order Dates (from Northwind's Orders) which occurred on Monday, Tuesday or Friday, you could use this: SELECT orders.* FROM orders WHERE (((InStr(" 2 3 6",Weekday([OrderDate])))>0)); |