| 265 | | final public function countBy($searchcond) { |
|---|
| 266 | | $query = 'SELECT COUNT(*) as c '.$this->_fromClause.$this->_whereClause; |
|---|
| | 265 | final public function countBy($searchcond, $distinct=null) { |
|---|
| | 266 | $count = '*'; |
|---|
| | 267 | if ($distinct !== null) { |
|---|
| | 268 | $props = $this->getProperties(); |
|---|
| | 269 | if (isset($props[$distinct])) |
|---|
| | 270 | $count = 'DISTINCT '.$this->_tables[$props[$distinct]['table']]['realname'].'.'.$props[$distinct]['fieldName']; |
|---|
| | 271 | } |
|---|
| | 272 | |
|---|
| | 273 | $query = 'SELECT COUNT('.$count.') as c '.$this->_fromClause.$this->_whereClause; |
|---|