Fresh Blurbs

Drupal: Monthly Tagging Statistics

Ever wondered about the frequency of a particular tag or tags over time? The SQL query below can quickly mine that information from a Drupal database:

select count(*), mons
from (
    select n.nid,n.changed, t.tid, 
    DATE_FORMAT( FROM_UNIXTIME(n.changed), '%Y%m') mons 
    from node n
    inner join term_node as t on t.nid=n.nid 
    where t.tid=14769
    group by n.nid) as trm_x_node
group by mons order by mons asc
comments powered by Disqus