best vba or excel posts, a week ago today

1

Please login or register to vote for this query.

(click on this box to dismiss)

voteworthy

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

declare @today date = cast(getdate() as date)

select id, creationdate, score,answercount,commentcount,tags,owneruserid,posttypeid,viewcount
into #posts from posts
where(tags like '%excel%' or tags like '%vba>%')
  and (creationdate between dateadd(d,-8,@today) and dateadd(d,-7,@today) )
  and body like '%</code>%' --includes code
  and posttypeid in (1,2)
  and score > -3

select 'Q' as Type,
  format(Creationdate,'MMM d HH:mm') as Asked,
  Score,
  answercount as Answers,
  Commentcount as Cmnts,
  viewcount as Views,
  owneruserid as uid,
  Tags,
  id as ID
into #x from #posts
where posttypeid=1

insert into #x select 'A' as Type,
  format(a.Creationdate,'MMM d  H:mm') as Asked,
  a.Score,
  q.answercount as Answers,
  a.Commentcount as Cmnts,
  q.viewcount as Views,
  a.owneruserid as uid,
  q.Tags,
  a.id as ID
from #posts q left outer join posts a on q.id=a.parentid
where a.posttypeid=2 and q.posttypeid=1

select 
    [Type], 
    x.id as [Post Link], 
    Score,
    Answers, 
    Cmnts, 
    x.Views,
    Tags,  
    u.reputation as [Author Rep], 
    datediff(d,u.creationdate,@today) as [User Days],
    uid as [User Link]
from #x x left outer join users u on u.id=x.uid
order by [Type] desc, score desc, answers desc, Cmnts desc

Enter Parameters

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