Invalid query : select ttTecmoOrder, ttName, ttCity , sum(gsTackles) as tacks, sum(gsTackles)/COUNT(DISTINCT(gsgUID)) as avgtacks, sum(gsDINTs) as ints, sum(gsDINTs)/COUNT(DISTINCT(gsgUID)) as avgints, sum(gsSacks) as sacks, sum(gsSacks)/COUNT(DISTINCT(gsgUID)) as avgsacks, ttPointsAgainst as pts, ttPointsAgainst/COUNT(DISTINCT(gUID)) as avgpts , tttID, COUNT(DISTINCT(gsgUID)) as gp from player_atts, standings, game_stats, games where pttUID = ttTecmoOrder AND pUID = gspUID AND plUID = 1 AND gslUID = plUID AND ttlUID = gslUID AND gsSeason = 1974 AND tttID = gsTeam AND psUID = gsSeason AND gsTeam = tttID AND psUID = ttsUID AND gsWeek <= 14 AND gPlayoff != 9 AND gpoff != 9 AND gUID = gsgUID AND gUID = gsgUID group by tttID order by desc, avgpts asc, ints desc, sacks desc, avgtacks desc