Fix naive way of taking maximum, Hive max is an aggregate function. Use IFs instead.

Summary: Fix for the failed daily emr report

Test Plan: student_teacher_count.q should not fail

Reviewers: jace

Reviewed By: jace

Differential Revision: http://phabricator.khanacademy.org/D2368