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 |
|
rehan
Starting Member
1 Post |
Posted - 2007-08-13 : 07:10:23
|
| How to sort day of week starting by Monday?select first_name name, hire_date , TO_CHAR(hire_date, 'day') Dayfrom employees------------------------------...my above query is working well except that I want to sort the rows order by day of week starting from Monday. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2007-08-13 : 07:15:58
|
| select first_name name, hire_date , DATENAME(weekday,hire_date) Dayfrom employeesORDER BY DATEPART(weekday,hire_date)Jim |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-13 : 08:02:46
|
quote: Originally posted by rehan How to sort day of week starting by Monday?select first_name name, hire_date , TO_CHAR(hire_date, 'day') Dayfrom employees------------------------------...my above query is working well except that I want to sort the rows order by day of week starting from Monday.
FYI, this is Microsoft SQL Server Forum MadhivananFailing to plan is Planning to fail |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2007-08-13 : 08:52:56
|
| Just Try this.SELECT * ,DATENAME(weekday,hire_date) FROM emp ORDER BY DATEPART(weekday,hire_date-1) |
 |
|
|
|
|
|
|
|