Q&A for scientists using computers to solve scientific problems
declare @question int = 1; declare @retag int = 6; declare @tagToSearch nvarchar(35) = ##tag1:string?gas##; declare @tagToSearch2 nvarchar(35) = ##tag2:string?google-apps-script##; select cast(PH.CreationDate as date), Posts.Tags, Posts.Id as [Post Link] from Posts inner join PostHistory as PH on PH.PostId = Posts.Id where Posts.PostTypeId = @question and PH.PostHistoryTypeId = @retag and ( charindex('<' + @tagToSearch + '>', PH.Text) > 0 and charindex('<' + @tagToSearch + '>', Posts.Tags) = 0 and charindex('<' + @tagToSearch2 + '>', Posts.Tags) > 0 ) group by Posts.Tags, Posts.Id, cast(PH.CreationDate as date) order by cast(PH.CreationDate as date) desc