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 |
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-06-18 : 14:50:48
|
| I need to sort some data by month or extract data for a particular month. My date format is 5/7/2007 11:38:54 AM. What is the easiest way to achieve this?Melvin FelicienIT ManagerDCG Properties Limited |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-18 : 14:57:05
|
| select * from table1where col1 >= '20070701' and col1 < '20070801'Peter LarssonHelsingborg, Sweden |
 |
|
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-06-18 : 15:00:35
|
| thank you but i need to know how to sort it by month as well where it will list it in the following format?JanuaryFeburaryEtcMelvin FelicienIT ManagerDCG Properties Limited |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-18 : 15:03:15
|
| select year(col1), datename(month, col1)from table1order by col1Peter LarssonHelsingborg, Sweden |
 |
|
|
thehandsomecode
Yak Posting Veteran
51 Posts |
Posted - 2007-06-18 : 15:16:05
|
| Thank you this works perfectly.Melvin FelicienIT ManagerDCG Properties Limited |
 |
|
|
|
|
|