Invalid query dude : select CASE WHEN (pRP+pRS>=100 OR (pHP>=75)) THEN 'A' WHEN ((pRP+pRS>=82 AND pRP+pRS<100 AND pHP < 75) OR (pRP+pRS<82 AND pHP>=63 AND pHP < 75)) 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 , 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 = 2010 AND tttID = gsTeam AND psUID = gsSeason AND gsTeam = tttID AND psUID = ttsUID AND gsWeek <= 20 AND pos = 5 group by gspUID, gsTeam having (sum(gsDINTS) > 0 OR sum(gsSacks) > 0 ) order by desc, Sacks desc, DINTS desc, AvgDINT desc, DINTTDs desc