Sign In  |  Register
 
 
DotNetNuke Support Forums
Page Views per Month
Last Post 09 Feb 2007 12:53 PM by Mariette. 2 Replies.
Printer Friendly
Sort:
PrevPrevNextNext
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
AuthorMessages
Mariette
Basic Member
Basic Member
Send Private Message
Posts:100
Avatar

--
09 Feb 2007 04: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

John Mitchell
Administrator
Veteran Member
Veteran Member
Send Private Message
Posts:4350
Avatar

--
09 Feb 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
Basic Member
Basic Member
Send Private Message
Posts:100
Avatar

--
09 Feb 2007 12:53 PM  
Thanks
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.


Active Forums 4.1
Visit our Store for great DotNetNuke Modules and Skins
DotNetNuke CSS Menu 3.4.6 (single use)

Item codeCSSNM33SU
AuthorJohn Mitchell
Base Price$39.00
Product Information 
DotNetNuke CSS NavMenu 3.4.6 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
DotNetNuke Performance Caching & Compression - PageBlaster 3.4.5 - Professional Edition

AuthorJohn Mitchell
Base Price$59.00
Product Information