Groups | Blog | Home
all groups > sql server mseq > may 2004 >

sql server mseq : Count on a date column


Dhondt Stijn
5/19/2004 4:26:11 AM
All

I need to count dates in a column but how can i cut of the time hour minutes and seconds
I need to rport how many records hav been added on one date...
con someone help me getting on the richt track

Nigel Rivett
5/19/2004 5:49:01 AM
select count(*)
from tbl
where convert(varchar(8),dte,112) = '20040515'

select count(*)
from tbl
where dte >= '20040515' and dte < '20040515'

select dte = convert(varchar(8),dte,112), num = count(*)
from tbl
group by convert(varchar(8),dte,112)
order by convert(varchar(8),dte,112)

one of those should help.



Nigel Rivett
www.nigelrivett.net

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button