Hello Group,
I am having a really weird problem... Can anyone tell the difference
between Query 1 and Query 2 below? Why Query 2 excludes '2/28/2005'?
Many thanks!
create table a
(ApplicationID int
,timestamp datetime)
insert into a values(1111,'2/26/05 3:24')
insert into a values(2222,'2/25/05 19:03')
insert into a values(1111,'2/4/05 14:54')
insert into a values(2222,'2/28/05 23:10')
--Query 1--
select year(timestamp) app_year
,month(timestamp) app_month
,day(timestamp) app_day
,count(distinct applicationid) numapps
from a
where year(timestamp)=2005 and month(timestamp)=2
group by year(timestamp)
,month(timestamp)
,day(timestamp)
order by year(timestamp)
,month(timestamp)
,day(timestamp)
--Query 2--
select year(timestamp) app_year
,month(timestamp) app_month
,day(timestamp) app_day
,count(distinct applicationid) numapps
from a
where timestamp between '2/1/2005' and '2/28/2005'
group by year(timestamp)
,month(timestamp)
,day(timestamp)
order by year(timestamp)
,month(timestamp)
,day(timestamp)