Invalid query : select CASE WHEN (pMS+pHP>=112) THEN 'A' WHEN (pMS+pHP<112) THEN 'B' ELSE '' END AS Grade, pUID, first, last, ttAbrev, ttTecmoOrder, sum(gsDINTs) as DINTs, sum(gsDINTYards) as DINTYards, sum(gsDINTYards)/sum(gsDINTs) as AvgDINT, sum(gsDINTTDs) as DINTTDs, sum(gsSacks) as Sacks , sum(gsTackles) as tacks , tttID, pNumber, COUNT(DISTINCT(gsgUID)) as gp, pInjured, dyear 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 = 1974 AND tttID = gsTeam AND psUID = gsSeason AND gsTeam = tttID AND psUID = ttsUID AND gsWeek <= 14 AND gPlayoff != 9 AND pos = 5 group by gspUID, gsTeam having (sum(gsDINTS) > 0 OR sum(gsSacks) > 0 OR sum(gsTackles) > 0) order by desc, Sacks desc, DINTS desc, AvgDINT desc, DINTTDs desc