Q&A for Drupal developers and administrators
; with tagshistory_cte AS ( SELECT Id AS phid, replace(value,'>','') TagName FROM PostHistory CROSS APPLY STRING_SPLIT(Text,'<') Where PostHistoryTypeId in (3,6,9) and len(value) > 0 ) SELECT DISTINCT(th.tagname) FROM tagshistory_cte th WHERE (th.tagname LIKE '%##text1?divis##%') AND (th.tagname LIKE '%##text2?infin##%') ORDER BY th.tagname