Code
use bn
set dateformat dmy
declare @start datetime, @stop datetime
select @start='14.01.2012',@stop='16.01.2012'
select o.ObjectGarNum, isnull(c.col,0) coun_all,isnull(c2.col,0) from dbo.FLEET_Object as o
left join (select ObjectID,COUNT(*) as col from dbo.SYS_DEV_ArchiveData
where tele_time between @start and @stop
group by ObjectID
) as c on c.ObjectID=o.ObjectID
left join
(select ObjectID,COUNT(*) as col from dbo.SYS_DEV_ArchiveData
where tele_time between @start and @stop and flags&4=0
group by ObjectID
) as c2 on c2.ObjectID=o.ObjectID