Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Page Views per Month

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
Mariette
Posts:102



02/09/2007 4:50 AM  

I have a little query that shows the page views per month but it always adds .00 at the end. How do I get rid of that?

-- Page Views per Month
select convert(varchar,cast(count(*) as money),1) as 'Page views'
from SiteLog
where Datediff(day, datetime, GETDATE()) <=30



DotNetNuke Platinum Benefactor
Mariette Knap - www.smallbizserver.net
John Mitchell
Posts:3033



02/09/2007 10:16 AM  

Ok, first let me preface this answer by saying that it is not a good idea to try and format strings with SQL. The DB layer is not meant to do that type of processing, so it will not perform as well as doing it in the presentation or business logic layer.

If you want commas without the decimal you can do it like this:


Select SubString(convert(varchar,cast(count(*) as money),1),0,Len(convert(varchar,cast(count(*) as money),1))-2)  AS 'Page Views'
from SiteLog
where Datediff(day, GameDate, GETDATE()) <=30

Mariette
Posts:102



02/09/2007 12:53 PM  
Thanks


DotNetNuke Platinum Benefactor
Mariette Knap - www.smallbizserver.net
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >General-DNN-Help > Page Views per Month



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information