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
 General SQL Server Forums
 New to SQL Server Programming
 SQL

Author  Topic 

syedrafi
Starting Member

1 Post

Posted - 2012-04-10 : 09:30:57
hi how to retieve the data based on joiningdate
Eg : Joining date of member on last month 10/3/2012
now i have to display the result for every month which is based on joining date .


syedrafi

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-04-10 : 10:51:42
select
year(joiningdate) as [Year],
month(joiningdate) as [Month],
count(*) as [MembersJoined]
from table
group by year(joiningdate), month(joiningdate)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-10 : 15:23:07
what according to your represents a month period? is it same as actual month or is it 30 day window from joining date?

ie 10/3/2012 to 09/04/2012 - Month1
10/4/2012 to 09/05/2012 - Month2 etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -