$query = "SELECT COUNT(id) from #__content WHERE catid = 17 AND state = 1";
$database->setQuery($query);
$result = $database->loadResult();
$query = $db->getQuery(true)
->select($db->quoteName('something'))
->from('#__mydatabasetable')
->where($db->quoteName('this').' = '.$db->quote('that'));
$db->setQuery($query);
$result = $database->loadResult();
$query = $db->getQuery(true)
->select('COUNT(' . $db->quoteName('id') . ')')
->from('#__content')
->where($db->quoteName('catid') . ' = 17')
->where($db->quoteName('state') . ' = 1');
$db->setQuery($query);
$result = $database->loadResult();
{articles category="17" limit="1"}[category] has [total-no-limit] article(s).{/articles}