Skip to content

Instantly share code, notes, and snippets.

@micheleorselli
Created March 24, 2011 15:11
Show Gist options
  • Save micheleorselli/885212 to your computer and use it in GitHub Desktop.
Save micheleorselli/885212 to your computer and use it in GitHub Desktop.
Count only the tag assignments of the last 90 days
// Performance TODO: We should use the asset_cnt!
// But than we should first really delete DELETED assets (at least in tag2asset)
// Count only the tag assignments of the last 90 days
// M E S S A G E :
// status disabled for debugging reasons.
// WHERE a.status >= :stat
$conditions = array(
'((a.embargo_date <= NOW()) OR (a.embargo_date IS NULL))',
'((a.expire_date > NOW()) OR (a.expire_date IS NULL))',
'a.asset_id = ta.asset_id',
'ta.tagtype_id IN('.$tagtype.')',
't.tag_id = ta.tag_id',
'ta.created_at > DATE_SUB(CURDATE(), INTERVAL 90 DAY)'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment