task2 Teterin

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

SELECT tag,
       post_date
FROM
  (SELECT rank() OVER (PARTITION BY tag
                       ORDER BY count(tag) DESC) tag_rank,
                      count(tag) AS num,
                      tag,
                      post_date
   FROM
     (SELECT p.id,
             t.tagname AS tag,
             CONCAT(DATENAME(mm, p.creationdate), '-', DATEPART(yy, p.creationdate)) AS post_date
      FROM posts p
      INNER JOIN posttags pt ON p.id = pt.postid
      INNER JOIN tags t ON pt.tagid = t.id
      WHERE p.tags IS NOT NULL ) AS answer
   GROUP BY tag,
            post_date)AS answer2
WHERE tag_rank = 1;

Enter Parameters

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