Invalid query : select CASE WHEN (pMS>=56) THEN 'A' WHEN (pMS=44 OR pMS=50) THEN 'B' ELSE 'C' 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(gsDINTs)*3+sum(gsSacks)*2 as Points , sum(gsTackles) as tacks , 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 = 2 AND gslUID = plUID AND ttlUID = gslUID AND gsSeason = 1994 AND tttID = gsTeam AND psUID = gsSeason AND gsTeam = tttID AND psUID = ttsUID AND gsWeek <= 16 AND pos = 6 group by gspUID, gsTeam having (sum(gsDINTS) > 0 OR sum(gsSacks) > 0 OR sum(gsTackles) > 0) order by asc, Points desc, Sacks desc, DINTS desc, AvgDINT desc, DINTTDs desc