Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 I need to build a recordset.

Author  Topic 

enak
Starting Member

34 Posts

Posted - 2006-04-23 : 22:35:09
I have a client that has a spreadsheet that contains sales totals for each sales person for each day of the month.

The first column in the spreadsheet is the sales person's name. After that the rest of the columns are filled with totals for a given day. For example, for this month the second column would contain the totals for April 1, the third column would contain the totals for April 2, etc.

I can get the totals one day at a time by using this query:

select interviewer, count(*) As Interviews from interview
Where int_date = '04/01/2006'
Group By Interviewer
order by interviews Desc

I need to know how to query all of the days of the month up to today and return all of the data in one recordset. I want to do this in a stored procedure.

Thanks,
enak

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-23 : 23:45:26
select interviewer, int_date, count(*) as interviews
from interview
where int_date >= '20060401'
and int_date < '20060501'
group by interviewer, int_date



KH


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-24 : 02:32:22
Create sp with Date ranges as parameters and use that query

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -