select posts.body , case when Reputation < 15 then 1 whe...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

--reate table #posts(body nvarchar(max),
--                   repcategory tinyint)
-- create index #idx_posts on #posts(repcategory)

select posts.body
     , case 
         when Reputation < 15 then 1 
         when reputation between 15 and 50 then 2
         else 3
       end as repcategory
into #posts
from Users 
inner join posts on posts.owneruserid = users.id
WHERE Users.Reputation < 100
and posttypeid = 2

select 
   choose(
      repcategory, 
     'None', 
     'FlagOnly',
     'FlagAndComment') AS Privilege,
   Count(*) [PrivilegeCount] 
from #posts
where body like '%##sitename?stackoverflow##%'
and (body like '%http:%' 
or body like '%https:%')
group by repcategory

Enter Parameters

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