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 , tttID, pNumber, COUNT(DISTINCT(gsgUID)) as gp, pInjured from player_atts, tecmoplayer, standings, game_stats where pUID = pID AND pttUID = ttTecmoOrder AND pUID = gspUID AND plUID = 1 AND gslUID = plUID AND ttlUID = gslUID AND gsSeason = 2003 AND tttID = gsTeam AND psUID = gsSeason AND gsTeam = tttID AND psUID = ttsUID AND gsWeek <= 16 group by tttID order by desc, ints desc, sacks desc, avgtacks desc