I am currently pulling a recordset from a sql database. I am using the SQL Server 7 count function to count each record that is being pulled.
There are currently four criteria I am looking for. The data is grouped by date. If no rows are retruned then I need the count to return a 0. I need to know if this is possible. Right now, it is only returning dates with data in it.
The following is an example:
Select
date,
count (*) as Numbers
from
table 1
inner join table 2
on number
where
date between @startdate and @enddate and
territory = @territory and
code = @code and
org = @org
group by date, territory, code, org
order by date, territory, code, org
I need to know if there is any possible way to correct this in SQL without using external code. Any suggestions would be really appreciated.
There are currently four criteria I am looking for. The data is grouped by date. If no rows are retruned then I need the count to return a 0. I need to know if this is possible. Right now, it is only returning dates with data in it.
The following is an example:
Select
date,
count (*) as Numbers
from
table 1
inner join table 2
on number
where
date between @startdate and @enddate and
territory = @territory and
code = @code and
org = @org
group by date, territory, code, org
order by date, territory, code, org
I need to know if there is any possible way to correct this in SQL without using external code. Any suggestions would be really appreciated.