Aggregate functions in SQL

When using aggregate functions is SQL it is important to only SELECT the columns you absolutely need.  In my last post I was trying to achieve basically the same thing as in this one, however even though it achieved the same results I was unable to use it to display the results I want without my function getting really complicated. 
 

So I went back to the drawing board and tried to achieve my results with straight up SQL. This is my initial stab at it.


<cfquery name="totalMin" datasource="muraLocal">
SELECT  SUM (tFT_minutes.min_exer) As totalTime, tFT_teams.name_teams, tFT_minutes.userID_exer,  tFT_minutes.date_exer
FROM    tFT_teams INNER JOIN
                    tFT_jointeam ON tFT_teams.tID = tFT_jointeam.tID_join INNER JOIN
                    tFT_minutes ON tFT_jointeam.userID_join = tFT_minutes.userID_exer
            WHERE tFT_teams.name_teams = '#selectAllTeams.name_teams#';
-- Group By tFT_teams.name_teams
</cfquery> 

When I ran this I received the error Column 'tFT_teams.name_teams' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I eventually asked my co-worker how what the issue was? He looked at the SQL and said that when you group it groups by unquineness so if I wanted to just get the total minutes of a particular group name just pull the columns you need.

SELECT   tFT_teams.name_teams, SUM(tFT_minutes.min_exer) AS Totalmin
FROM      tFT_teams INNER JOIN
          tFT_jointeam ON tFT_teams.tID = tFT_jointeam.tID_join INNER JOIN
          tFT_minutes ON tFT_jointeam.userID_join = tFT_minutes.userID_exer
WHERE        (tFT_teams.name_teams = 'dudehammer')
GROUP BY name_teams


By getting rid of the extra columns and just grouping on the name at that point gave me the exact results I needed. My team name and the totalmin was 464.