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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 group by date

Author  Topic 

maya_zakry
Constraint Violating Yak Guru

379 Posts

Posted - 2007-02-02 : 01:39:15
hi all..

my group by clause has to select date.. problem is it differentiate
2006-01-23 15:45:34.000 and 2006-01-23 15:46:55.000 ..

As we all know, for sure we need to group all the 23 jan date into one without bothering the time, so how do i let the query pick only one line for date 23 jan?? thankss in advance...



~~~Focus on problem, not solution~~~

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-02 : 01:41:02
use dateadd(day, datediff(day, 0, datecol), 0) to remove the time


KH

Go to Top of Page

maya_zakry
Constraint Violating Yak Guru

379 Posts

Posted - 2007-02-02 : 02:20:26
ohh tq so much..!!! how fast... luv this forum..
at first i apply it only in SELECT .. but it still split the records, then i paste to my group by clause and voila!!! tq so much khtan!!

~~~Focus on problem, not solution~~~
Go to Top of Page
   

- Advertisement -