Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

return count by individual days Expand / Collapse
Author
Message
Posted Tuesday, August 5, 2014 9:20 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 14, 2014 7:47 AM
Points: 25, Visits: 108
Hi i am using the followig query :
select count (*) from MEMBERS,dbo.MEMBER_PROFILE
where MEMBER_PROFILE.member_no = members.member_no
AND JOIN_DATE between '07-01-2013 00:01' and '07-31-2013 11:59'
and email <> 'selfbuy_customer@cafepress.com'
and ROOT_FOLDER_NO is not null
and email not like '%bvt.bvt'
This returns the count for the month but I want to see what the total each day was.

Thanks

George
Post #1599788
Posted Tuesday, August 5, 2014 9:25 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 5:47 AM
Points: 118, Visits: 179
Add JOIN_DATE to the Select list and a group by:

select JOIN_DATE , count (*) from MEMBERS,dbo.MEMBER_PROFILE 
where MEMBER_PROFILE.member_no = members.member_no
AND JOIN_DATE between '07-01-2013 00:01' and '07-31-2013 11:59'
and email <> 'selfbuy_customer@cafepress.com'
and ROOT_FOLDER_NO is not null
and email not like '%bvt.bvt'
GROUP BY JOIN_DATE

Post #1599796
Posted Tuesday, August 5, 2014 9:31 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 14, 2014 7:47 AM
Points: 25, Visits: 108
Thanks Loudclear but the count returns as 1 need the count sum for each day
Post #1599803
Posted Tuesday, August 5, 2014 9:34 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 14, 2014 7:47 AM
Points: 25, Visits: 108
sum is probably incorrect what I need is the total for each day
Post #1599806
Posted Tuesday, August 5, 2014 9:38 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 5:47 AM
Points: 118, Visits: 179
If you provide your table structure, some sample data and your expected results, I could help you better.

See some guidance on providing this kind of thing here:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1599812
Posted Tuesday, August 5, 2014 10:40 AM This worked for the OP Answer marked as solution
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 14, 2014 7:47 AM
Points: 25, Visits: 108
Thanks for the response but i used cast(convert(char(10),JOIN_DATE,121) as date) as day in query and got the resluts i was looking for
Post #1599847
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse