Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have to create a stored procedure where it does a count on the CallAttened field for each week. I am not sure how to do this. I am really new to SQl can someone show me how to do this.
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts
Posted - 2009-04-14 : 16:01:56
Well..can you provide the table structure and some sample data...Is there some kind of date field that will help us find out the duration ?You may need to use something like this..select count(callattended) from <urtable> where dat_col > <fromdate> and date_col < <todate>
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-04-15 : 13:26:27
something like
SELECT Count(CallAttended), DATEADD(wk,DATEDIFF(wk,0,CallCreatedDate),0)FROM YourtableGROUP BY DATEADD(wk,DATEDIFF(wk,0,CallCreatedDate),0)