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 |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-06-04 : 03:11:38
|
CREATE PROCEDURE [dbo].[getnumberpaidpersite] @fromdate datetime, @todate datetime, @userid intASBEGIN declare @paid int -- SET NOCOUNT ON added to prevent extra result sets from SET NOCOUNT ON; SELECT count(id) as mycount,usertype from payments where received>=@fromdate and received<=@todate group by usertypereturnENDwith the above spthis returns nowusertype mycount001 11002 6based on the dates now what i really want is to take bring the count for the week of @fromdate so that it should returnusertype sunday monday tuesday wed thursday friday (only until the @fromdate) (so if @fromdate is monday it will only return sunday and monday)001 1 3 4 1 1 1002 1 2 3 0 0 0can someone help me with this? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-04 : 03:53:42
|
After more than 500 posts, you should know how to search to CROSSTAB / PIVOT queries.Peter LarssonHelsingborg, Sweden |
|
|
pootle_flump
1064 Posts |
Posted - 2007-06-04 : 04:51:30
|
http://www.dbforums.com/showthread.php?p=6276233&posted=1#post6276233 |
|
|
|
|
|