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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-31 : 08:58:25
|
| Adam P. writes "I am writing a view and I need to group the data only by a date. The problem is that since both datatypes datetime and smalldatetime store both date and time. I can't seem to figure out the way to format the GROUP BY clause to group the data by only the date and not the time." |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-01-31 : 09:04:07
|
| You can use the CONVERT() function to remove the time portion:SELECT Convert(char(10), dateCol, 101) AS Date FROM myTableGROUP BY Convert(char(10), dateCol, 101)Check Books Online for more information on the CONVERT() function, it can do a lot more than this. |
 |
|
|
|
|
|