Why are all these fields selected when I only want id

SQL

Why are all the fields in TASKS selected here when I am only asking for id?  This is my code

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
* @param string $parent_id
* @param string $type
* @param array $status
* @param string $subject
* @param bool $billing
* @return bool|false|string
*/
function checkForTask(string $parent_id, $type = 'Order Master', $status = array(), $subject = '', $billing = false)
{
try {
$query = new SugarQuery();
$from = $query->from(BeanFactory::newBean('Tasks'), IGNORE_TEAMS)->getFromAlias();
$query->select(array("{$from}.id"));
$query->where()->equals('task_type_c', $type);
if ($billing) {
$tasks = $query->join('tasks_tasks_1', IGNORE_TEAMS)->joinName();
$query->where()->equals("{$tasks}.id", $parent_id);
} else {
$query->where()->equals('parent_id', $parent_id);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX