Questo esempio esegue una query per ottenere il numero dei post diogni gruppo (OG)
<?php $rows = array(); $results = db_query("SELECT DISTINCT nn.title as title, count(m.etid) as counter FROM node as n LEFT JOIN og_membership as m ON n.nid = m.etid AND m.entity_type='node' AND n.type='post' LEFT JOIN node as nn ON nn.nid = m.gid WHERE n.status = 1 GROUP BY m.gid"); $header = array('Group Title','Total Post'); $rows = array(); foreach($results as $key) { $rows[] = array($key->title, $key->counter); } return theme('table', array('header' => $header, 'rows' => $rows)); ?>