Invalid query : select CASE WHEN (((pos = 2 OR pos = 3) AND pHP > 13) AND (pMS+pREC>=88)) THEN 'A' ELSE 'B' END AS Grade, pUID, first, last, ttAbrev, ttTecmoOrder, sum(gsReceptions) as Receptions, sum(gsReceptionYards) as ReceptionYards, sum(gsReceptionYards)/sum(gsReceptions) as AvgRec, sum(gsReceptionTDs) as ReceptionTDs , 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 = 3 OR pos = 2) AND pHP > 13) group by gspUID, gsTeam having sum(gsReceptions) > 0 order by desc, ReceptionYards desc, AvgRec desc, ReceptionTDs desc