Get posts by tag

1

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

DECLARE @Tag nvarchar(25) = 'geotools';

SELECT 
  Posts.Id , Posts.Title, Posts.Body
FROM Tags
  INNER JOIN PostTags ON PostTags.TagId = Tags.Id
  INNER JOIN Posts ON Posts.Id = PostTags.PostId
WHERE
  Tags.TagName = @Tag AND
  Posts.PostTypeId = 1 -- Questions
ORDER BY Posts.CreationDate DESC

Enter Parameters

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