Tags/Vets/Younger

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity Meta

Q&A about the site for committed Christians, experts in Christianity and those interested in learning more

select young.tagname tagname,
young.age_cat ,
young.rep_tot young_rep, 
young.score_tot young_score,
young.users_tot young_users,
veteran.age_cat,
veteran.rep_tot vet_rep, 
veteran.score_tot vet_score,
veteran.users_tot vet_users

from
(select 
tags.tagname,
'younger' as age_cat,
sum(users.reputation) rep_tot, 
sum(posts.score) score_tot,
count(posts.owneruserid) users_tot
from users, posts, posttags, tags 
where
users.age is not null and users.age between 15 and 39
and users.reputation between 2 and 100000 
and year(posts.creationdate)=2012
and posts.owneruserid=users.id
and posts.id = posttags.postid
and posttags.tagid=tags.id
group by tags.tagname) young,
(select 
tags.tagname,
'veteran' as age_cat,
sum(users.reputation) rep_tot, 
sum(posts.score) score_tot,
count(posts.owneruserid) users_tot
from users, posts, posttags, tags 
where
users.age is not null and users.age > 39
and users.reputation between 2 and 100000 
and year(posts.creationdate)=2012
and posts.owneruserid=users.id
and posts.id = posttags.postid
and posttags.tagid=tags.id
group by tags.tagname) veteran
where young.tagname=veteran.tagname
and veteran.users_tot > 4

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results