Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
SQL statements for some usage statistics New Code
By theantix , Section Code []
Posted on Tue Jul 22, 2003 at 12:00:00 PM PST
As a scoop admin, you might be interested to see how your users are using your site.  I wrote these SQL statements to check up on the users on my site, but I thought perhaps there might be some general interest from other admins, so here are some SQL statements that you can try out yourself.

All you should need to run these statements is a mysql prompt or phpmyadmin access.  Cut/Paste the query in and see who's using/abusing your site.

Without further adieu:

Most Stories:

select count(sid) as c_sid, aid from stories group by aid order by c_sid desc limit 10;

Most/Longest Stories:   

select sum(length(bodytext) + length(introtext)) as length, aid from stories group by aid order by length desc limit 10;

Most Comments:

select count(c.sid) as c_sid, u.nickname from comments c, users u where u.uid=c.uid group by c.uid order by c_sid desc  limit 10;

Most/Longest comments:

select sum(length(c.comment)) as length, u.nickname from comments c, users u where u.uid=c.uid group by c.uid order by length desc limit 10;

Read the most stories:

select count(v.sid) as c_sid, u.nickname from viewed_stories v, users u where v.uid=u.uid group by v.uid order by c_sid desc limit 10;

Read most comments:

select sum(v.lastseen) as s_seen, u.nickname from viewed_stories v, users u where v.uid=u.uid group by v.uid order by s_seen desc limit 10;

Busiest comment raters:

select count(cr.sid) as c_sid, u.nickname from commentratings cr, users u where cr.uid=u.uid group by cr.uid order by c_sid desc limit 10;

"Grumpiest" raters:

select count(cr.sid) as c_sid, cr.rating, u.nickname from commentratings cr, users u where cr.uid=u.uid and cr.rating=1 group by cr.uid, cr.rating order by c_sid desc, rating asc limit 10;

"Happiest" comment raters:

select count(cr.sid) as c_sid, cr.rating, u.nickname from commentratings cr, users u where cr.uid=u.uid and cr.rating=5 group by cr.uid, cr.rating order by c_sid desc, rating asc limit 10;

Best Rated:

select avg(c.points) as avg_rating, u.nickname from comments c, users u where c.uid=u.uid group by c.uid order by avg_rating desc limit 10;

Busiest Voters:

select count(p.qid) as c_votes, u.nickname from pollvoters p, users u where p.uid=u.uid group by p.uid order by c_votes desc limit 10;

Most popular poll options:

select aid as poll_item, avg(votes) as avg_votes from pollanswers group by aid order by poll_item limit 10;

< Gauntlet.ca underway | Scoop Install on OpenBSD 3.3 Problem: DBD::mSQL >

Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Login
Make a new account
Username:
Password:

Poll
Usage stats?
· Thanks 66%
· No Thanks 0%
· - 0%
· theantix was here 33%

Votes: 3
Results | Other Polls

Related Links
· Scoop
· More on New Code
· Also by theantix

Story Views
  47 Scoop users have viewed this story.

Display: Sort:
SQL statements for some usage statistics | 8 comments (8 topical, 0 hidden)
thanks man (none / 0) (#1)
by jacklee7 on Mon Mar 12, 2018 at 01:33:46 PM PST

Your SQL statement has much useful data. I have really applied to my SQL need and it worked for me. The best essay writing service reviews also mentioned this information in their publications. I want to thank you for sharing this useful key with others. Admin I always appreciate your work as you have done always a great job.



Thank you (none / 0) (#2)
by scdobre on Sat Jun 16, 2018 at 05:36:00 AM PST

Thank you! This is what I need to find. instagram search



BachJohann (none / 0) (#3)
by BlackMen on Thu Aug 09, 2018 at 05:43:00 AM PST

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. ereccion total pdf



All you (none / 0) (#4)
by annedua on Wed Oct 03, 2018 at 03:27:10 AM PST

All you should need to run these statements is a mysql prompt or phpmyadmin access. Cut/Paste the query in and see who's using/abusing your site. happy room full game.



best bathroom renovation nyc (none / 0) (#5)
by Pervez on Sun Mar 17, 2019 at 11:25:12 AM PST

Definitely When I fascinated with this write-up. Write-up is usually a pro in addition to appreciate the best way to maintain followers hooked up. At this point simply click here in addition to abide by this key word best bathroom renovation nyc Appreciate it intended for giving that with us.



Read it once (none / 0) (#6)
by RahulKapoor on Fri Oct 11, 2019 at 12:10:56 AM PST

Sharing is all about caring and that's why it is important for all of us because it can lead us to drag more, leads to enhance income. Go through my cypcommissioner page and follow me as well on Facebook, Twiter, and Instagram right now. This can help you to increase your traffic if you like our page.



thanks for this lesson (none / 0) (#7)
by zaneroundtree793 on Wed Nov 25, 2020 at 05:54:39 AM PST

I have question, sir what command we used for MS SQL for describe a table? Click Here



Additionally (none / 0) (#8)
by randolphbab on Wed Aug 11, 2021 at 01:45:09 AM PST

Leather Strap: These days, leather straps are only found on Rolex's dedicated dress watch series, the Cellini. Available in black, brown, or blue and fitted with an 18k gold buckle to match the case of the watch, the straps are fully remborded and stitched alligator leather. Additionally, in the past leather straps were offered on a much wider range of tag heuer replica, including select Daytona, Day-Date, and Datejust models.



SQL statements for some usage statistics | 8 comments (8 topical, 0 hidden)
Display: Sort:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search