I am having some trouble putting together a specific SQL query using the SQL plugin.
I'd like to run a query on the 10 pages with the highest number of comments created in the past week. This gives us a good sense of where the conversation is happening on our wiki.
I know this has to be possible, but I'm not having any luck.
Ideally, the output would be like this:
Where to find Waldo | 50 |
Carmen Miranda - fact or fiction? | 35 |
Oregon Trail comes to Kansas | 25 |
etc. |
select
(select c2.title from content as c2 where c2.contentid = c1.pageid) as "Page title",
count(*) as "Comments created in past week"
from content as c1
where c1.pageid is not null and c1.contenttype = 'COMMENT' and c1.creationdate > now() - interval '7 days'
group by c1.pageid
order by 2 desc
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.