Groups | Blog | Home
all groups > sql server clients > april 2005 >

sql server clients : Results are different


John
4/28/2005 12:00:00 AM
why the following two query's results are different... any idea why?

select count(*) from MedicalHistory where CDate between '01/01/2001' and
'12/31/2001'

1728066

select count(*) from MedicalHistory where year(CDate) = 2001

1739088

Thanks in advance....

Scott Morris
4/28/2005 12:00:00 AM
http://www.karaszi.com/SQLServer/info_datetime.asp

[quoted text, click to view]

David Gugick
4/28/2005 4:10:34 PM
[quoted text, click to view]

Try:

select count(*) from MedicalHistory
where CDate >= '01/01/2001'
and CDate < and '01/01/2002'


--
David Gugick
Imceda Software
John
4/28/2005 4:32:32 PM
Thanks David... so nice of you !

[quoted text, click to view]

AddThis Social Bookmark Button