наверно это
$cq = $DB->query( "SELECT tag_id, COUNT(*) AS count
FROM exp_tag_entries
WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
GROUP BY tag_id" );
foreach( $cq->result as $row )
{
$c[$row['tag_id']] = $row['count'];
}
$sql = "SELECT t.tag_name, t.tag_id, t.entry_date, t.edit_date, m.screen_name
FROM exp_tag_tags t
LEFT JOIN exp_members m
ON m.member_id = t.author_id
WHERE t.tag_name != ''
AND t.site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'";
if ( $IN->GBL('alpha','GP') )
{
$alpha = $this->_clean_str( $IN->GBL('alpha','GP'), TRUE );
$sql .= " AND t.tag_alpha = '".$DB->escape_str($alpha)."'";
}
if ( $str != '' )
{
$sql .= " AND t.tag_name LIKE ('".$DB->escape_str( $this->_clean_str( $str ) )."%')";
}
$sql .= " ORDER BY t.tag_name ASC";
$query = $DB->query($sql);