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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DATE

Author  Topic 

1sqlover
Yak Posting Veteran

56 Posts

Posted - 2006-10-26 : 10:34:42
How can I SELECT DISTINCT Dates in a table as a Date not a timestamp?

10-01-2006 00:05:06
10-01-2006 12:53:31
10-02-2006 04:20:30
10-03-2006 05:30:54
10-03-2006 06:30:30

AS

10-01-2006
10-02-2006
10-03-2006

Thanks,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-26 : 10:35:51
[code]
select distinct dateadd(day, datediff(day, 0, datecol), 0)
from table
[/code]


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-26 : 11:08:56
Where do you want to show data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

1sqlover
Yak Posting Veteran

56 Posts

Posted - 2006-10-26 : 11:29:15
Thanks, KHTAN it worked.

quote:
Originally posted by khtan


select distinct dateadd(day, datediff(day, 0, datecol), 0)
from table



KH



Go to Top of Page
   

- Advertisement -