<?php

/**
 * Class that operate on table 'knownways'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2023-09-11 09:10
 */
class KnownwaysMySqlExtDAO extends KnownwaysMySqlDAO
{

    public function queryAllWithClients()
    {
        $sql = 'SELECT  DISTINCT knownways.id, name, count(DISTINCT sellbill.sellbillclientid) AS clientCount
        FROM knownways
        Left JOIN sellbill 
        on knownways.id = sellbill.knownwayId
        where sellbill.conditions = 0
        group by knownwayId';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }
}
