I read berfore SQL Count for a Date Column and SQL to get count by date but these does not point my problem.
I have the following table records (the table has only two columns)
| VALUE | TIME |
--------------------------------
| test | 04.05.2012 11:46:46|
| test2 | 04.05.2012 11:46:49|
| test3 | 06.05.2012 11:47:46|
| test2 | 05.05.2012 11:47:46|
| test | 04.05.2012 11:51:46|
I want to display like:
| VALUE | COUNT | NEWTIME |
--------------------------------
| test | 2 |04.05.2012|
| test2 | 1 |04.05.2012|
| test2 | 1 |05.05.2012|
| test3 | 1 |06.05.2012|
I counted VALUE
by using day
as datepart of TIME
like:
select datepart(d, TIME), count(VALUE) from table1
group by datepart(d, TIME)
How to get also the additional NEWTIME
column ? It is possible in SQL Server 2005 ?
Thank you