Find [A] ([B] or [C])

1

Please login or register to vote for this query.

(click on this box to dismiss)

Search questions by tags intersection and union.

Stack Overflow

Q&A for professional and enthusiast programmers

declare @A nvarchar(25) = '##A?python##'
declare @B nvarchar(25) = '##B?datetime##'
declare @C nvarchar(25) = '##C?timezone##'

SELECT 
  q.Id AS [Post Link],
  q.Tags,
  q.LastActivityDate,
  q.CreationDate,
  q.AnswerCount,
  q.Score,
  q.ViewCount,
  q.OwnerUserId as [User Link]
FROM Posts q
  join PostTags pt on pt.PostId = q.Id
  join PostTags pt2 on pt2.PostId = q.Id
  join Tags t on t.Id = pt.TagId
  join Tags t2 on t2.Id = pt2.TagId
  join TagSynonyms ts on ts.TargetTagName = t.TagName
  join TagSynonyms ts2 on ts2.TargetTagName = t2.TagName
WHERE q.PostTypeId = 1     -- question
  and q.ClosedDate is null -- not closed
  and (t.TagName = @A or ts.SourceTagName = @A)
  and (t2.TagName in (@B, @C) or ts2.SourceTagname in (@B, @C))
GROUP BY q.Id, q.Tags, q.LastActivityDate, q.CreationDate,
  q.Score,
  q.ViewCount,
  q.AnswerCount,
  q.OwnerUserId
ORDER BY q.LastActivityDate DESC, q.CreationDate DESC, q.Score DESC, q.ViewCount DESC

Enter Parameters

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