Fix count when using joins.

This commit is contained in:
kj 2022-08-12 05:46:24 -04:00
parent 2411704662
commit 38d2a90318

View File

@ -682,7 +682,7 @@ class Model {
$queryResult = static::query($sql, $resetQuery); $queryResult = static::query($sql, $resetQuery);
$result = $queryResult[0]['quantity']; $result = $queryResult[0]['quantity'];
} else { } else {
static::$querySelect['select'] = ["COUNT(".static::$primaryKey.") as quantity"]; static::$querySelect['select'] = ["COUNT(".static::table().".".static::$primaryKey.") as quantity"];
static::$querySelect['limit'] = '1'; static::$querySelect['limit'] = '1';
static::$querySelect['orderBy'] = ''; static::$querySelect['orderBy'] = '';