Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
egghi
Starting Member
17 Posts |
Posted - 2006-11-09 : 11:33:08
|
| Hi,I have a query that works but I need to sort the data by day of week..Right now, results look like this:Friday 2Saturday 1Thursday 3Wednesday 1And I need it to look likeWednesday 1Thursday 3Friday 2Saturday 1Here is the current query:SELECT Datename(dw,[Date]) AS [Day],COUNT(*)FROM Dates, TimeOffWHERE [Date] BETWEEN OffStartDate AND OffEndDate AND OffType = 'Sick Day' GROUP BY Datename(dw,[Date])ORDER BY .... |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-11-09 : 11:37:41
|
| [code]Order BY Datename(weekday,[Date])[/code]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
egghi
Starting Member
17 Posts |
Posted - 2006-11-09 : 11:44:48
|
| Hello Harsh,Thank you for your quick response! I added your order by statement but it did not work... The result still sorts in alphabetical order instead of day of week... |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2006-11-09 : 12:04:18
|
| use the day of week datepart ... not the datenameJay White |
 |
|
|
|
|
|