Users with one or more [identification] questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

-- Find users who have ever asked a question in the [identification] tag
-- (which is the default and can be changed below).

declare @tag as nvarchar(25) 
  = ##tag:string?identification##;

declare @tagid as int;

-- get the tag id here so it is not needed as a join table
select @tagid = Id
  from Tags
  where TagName = lower(@tag);

select distinct OwnerUserId as [User Id], 
    OwnerUserId as [User Link],
    Count(OwnerUserId) as [QCount]
  from
    posts inner join posttags on posts.Id = postTags.PostId
  where
    PostTypeId = 1 -- question
      and CommunityOwnedDate is null -- not CW
      and ClosedDate is null -- not closed
      and posttags.tagid = @tagid
  group by
    OwnerUserId
  having 
    count(owneruserid) > 0
  order by
    QCount Desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results