Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: None | Size: 0.53 KB | Hits: 53 | Expires: Never
Copy text to clipboard
  1.                 SELECT DISTINCT
  2.                         terms2.term_id as tag_id,
  3.                         terms2.name as tag_name,
  4.                         null as tag_link,  
  5.                         terms2.slug as slug,
  6.                         t2.taxonomy as taxonomy,
  7.                         t2.count as count,
  8.                         p2.*
  9.                 FROM
  10.  
  11.                 wp_posts as p2
  12.                 LEFT JOIN wp_term_relationships as r2 ON p2.ID = r2.object_ID
  13.                 LEFT JOIN wp_term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id
  14.                 LEFT JOIN wp_terms as terms2 ON t2.term_id = terms2.term_id
  15.                 WHERE
  16. p2.post_date > DATE_SUB(NOW(), INTERVAL 30 DAY)
  17.                 GROUP by tag_id
  18.                 ORDER by count
  19.                 DESC
  20.                 limit 3