|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need to do a GROUP BY on only the time portion of a datetime column. Such as:
GROUP BY FormatDateTime(clickdatetime,3) Is this possible? The field value is automatically put in the database by the getdate() function. Thanks. |
|
#2
|
||||
|
||||
|
look through the help for date functions: DAY(), MONTH() and YEAR() exist so there is probably also something like TIME()
|
|
#3
|
|||
|
|||
|
Code:
select Datepart(hour, getdate()) select Datepart(minute, getdate()) select Datepart(second, getdate()) select Datepart(millisecond, getdate()) |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > grouping on time in a datetime column |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|