I have a Query with a count
if ($this->mode == "anzahl") {
$query = Spieler::find();
$query->joinWith(['abgeschlosseneTurniere' => function () {
}]);
$query->select(['spieler.*', 'COUNT(teilnehmer.id) AS playerCount'])
->where(["istInRangliste" => 1])
//->andWhere(['>',"playerCount" , 0]);
$query->groupBy(['spieler.id']);
$query->orderBy(['playerCount' => SORT_DESC]);
if (isset($this->limit)) {
$query->limit($this->limit);
}
$models = $query->all();
}
i cannot use the alias for my greater than 0 Condition.
//->andWhere(['>',"playerCount" , 0]);
any ideas how i can get only greater than 0 from my count?
thanky you