public static function doCountJoinAllExceptDepartment(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(VClassGroupPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(VClassGroupPeer::COUNT); } foreach ($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } $rs = VClassGroupPeer::doSelectRS($criteria, $con); if ($rs->next()) { return $rs->getInt(1); } else { return 0; } }