A table with 7 rows having all weekdays as value. I just want a simple sql query to get all the values from the weekdays except weekends.
Asked
Active
Viewed 960 times
-3
-
2What have you tried so far? – Russ J Mar 21 '19 at 03:31
-
And what does your database look like? How are the values stored? Strings, Integers, etc – Reed Mar 21 '19 at 04:53
3 Answers
0
I hope this can help:
SELECT *
FROM [YourTableName] t
WHERE DATENAME(WEEKDAY,t.[YourDateField]) NOT IN ('Saturday','Sunday');

Dale K
- 25,246
- 15
- 42
- 71

Vitaly Borisov
- 1,133
- 2
- 13
- 20
0
Simple, Try this :
SELECT *
FROM [YourTable]
WHERE DATENAME(WEEKDAY,[DateField]) <> 'Saturday'
AND DATENAME(WEEKDAY,[DateField]) <> 'Sunday'
There is a Similar question with solutions.

Sabir Al Fateh
- 1,743
- 3
- 20
- 27
-1
MySQL WEEKDAY()
function returns the index of the day in a week for a given date (0 for Monday, 1 for Tuesday through to 6 for Sunday).
Syntax:
WEEKDAY(date)
Where date is a date.