I have a question about this line of code, see below

    
        //Initialize variables.
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        
        //Create the base select statement.
        $query->select('a.id as id, a.greeting as greeting, a.published as published')->from($db->quoteName('#__diolegend','a'));
        
        //Join over the categories.
        $query->select($db->quoteName('c.title' ,'category_title'))->join('LEFT',$db->quoteName('#__categories','c')
            . ' ON c.id =a.catid');

>         $query->select($db->quoteName('c.title' ,'category_title'))->join('LEFT',$db->quoteName('#__categories','c')
>             . ' ON c.id =a.catid');

How can it be possible to still retrieve  a.catid, we haven't select from anywhere...

Thank you everybody