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.
| Author |
Topic |
|
bluemagic74
Starting Member
15 Posts |
Posted - 2012-01-17 : 11:03:14
|
| Create table TABLE1[USERID] INT NULLENTRYTIME_INDAYS INT NULLGOSAMPLE DATAUSERID, ENTRYTIME_INDAYS1111,42222,13333,334444,75555,345.......Now I want to caliculate weekly entries per userI wrote this scriptselect userID , COUNT (*) as Week1 from TABLE1 where ENTRYTIME_INDAYS in (0,1,2,3,4,5,6) -- 0 to 6 daysgroup by USERIDIS there any way i can loop the all the weeks in scriptex: USERID, WEEK1,WEEK2,WEEK3,.....Thank you. |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
bluemagic74
Starting Member
15 Posts |
Posted - 2012-01-17 : 11:57:00
|
| ok. actually there is datetime column.USERID,ENTRYDATETIME,ENTRYTIME_INDAYS(added difference between registration complete date and ENTRYDATETIME)USERID,ENTRYDATETIME,ENTRYTIME_INDAYS1,2007-12-10,31,2007-12-12,42,2008-12-3,2343,2008-03-09,1NOW I NEED FOR WEEK1(0to 6 days) userid 1 count is 3...like that for all users...week1 week2 week3.... |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
bluemagic74
Starting Member
15 Posts |
Posted - 2012-01-17 : 12:22:11
|
| thank you.for this output shows year and counthow can get a particular week count |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|