-- setup
create table #t (date1 datetime, date2 datetime)
go
insert into #t values('1/1/2007', '2/2/2007')
insert into #t values('1/1/2007', '2/2/2007')
insert into #t values('3/3/2007', '4/4/2007')
insert into #t values('5/5/2007', '2/2/2007')
insert into #t values('1/1/2007', '3/3/2007')
go
-- query
select datetime, sum(date1count), sum(date2count) from
(select date1 [datetime], count(*) [date1count], 0 [date2count] from #t
group by date1
union
select date2, 0, count(*) from #t
group by date2) t1 group by [datetime]
-- results
/*
2007-01-01 00:00:00.000 3 0
2007-02-02 00:00:00.000 0 3
2007-03-03 00:00:00.000 1 1
2007-04-04 00:00:00.000 0 1
2007-05-05 00:00:00.000 1 0
*/