Results 1 to 1 of 1
-
01-04-2012, 06:34 PM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,175
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Archive by Year and Month Query - MSSQL
Archive by Year and Month Query - MSSQL
Here is an example query to retrieve years, months, number of posts made. This kind of query usually used in blogs.
Select COUNT(id),DATEPART(year, publishDate) as year
,DATEPART(MONTH,publishDate) as month
from BlogPosts
where
publishDate<=getdate()
group by DATEPART(year, publishDate), DATEPART(MONTH,publishDate)
order by year desc,month descFree Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
Similar Threads
-
How to Find MSSQL Server Version and Edition
By manik in forum DatabasesReplies: 0Last Post: 12-15-2011, 11:25 AM -
Nofollow and Noindex Tags for Wordpress Archive
By joesinghla in forum Search Engine OptimizationReplies: 3Last Post: 01-24-2011, 07:40 AM -
New Content Added To BNS Archive #1
By Baruti in forum General TalkReplies: 2Last Post: 11-21-2010, 09:00 PM -
Windows | cPanel |.NET,ASP,AJAX,XML,MSSQL|@ 6.95!
By TEE06 in forum Web Hosting ProvidersReplies: 0Last Post: 08-18-2010, 03:33 PM -
Advanced News Archive Search Tips
By BrainPulse in forum GoogleReplies: 0Last Post: 05-05-2009, 01:55 AM


Reply With Quote

