// Get the database group / connection
$connection = static::get_connection();
// Get the columns
$columns = \DB::expr('COUNT('.($distinct ? 'DISTINCT ' : '').
\Database_Connection::instance($connection)->quote_identifier($select).
') AS count_result');
It looks like you're new here. If you want to get involved, click one of these buttons!