Posts que tienen una etiqueta dada y no tienen otra etiqueta dada (escribir etiquetas en minúscula)


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow en español

Q&A for programadores y profesionales de la informática

  Posts_With_Tag1 AS
      posts.title as title, 
      posts.tags as tags, 
      posts.CreationDate as PostDate, 
      p.PostId as PostId, 
      (1.*(COUNT(*) OVER (PARTITION BY 1))) as cnt
    FROM PostTags p
       JOIN Tags t ON t.Id = p.TagId
       JOIN Posts posts ON posts.Id = p.PostId 
    WHERE t.TagName = ##ConEtiqueta:string##
  Posts_With_Tag2 AS
      p.PostId as PostId
    FROM PostTags p
        JOIN Tags t ON t.Id = p.TagId
    WHERE t.TagName = ##SinEtiqueta:string##
   Posts_With_Both AS
   ( SELECT 
       p1.PostDate as PostDate, 
       p1.title as title, 
       p1.tags as tags, 
       p1.PostID as PostID  
     FROM Posts_With_Tag1 p1
       LEFT OUTER JOIN Posts_With_Tag2 p2 ON p1.PostID=p2.PostID
         WHERE p2.PostID IS NULL

   PostDate fecha, 
   PostId [Post Link], 
 FROM Posts_With_Both

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results