@SuppressWarnings("unchecked")
    public String getOverviewTable() {
        PreparedStatement st = null;
        ResultSet rs = null;
        JSONArray json = new JSONArray();
        try {
            conn = dbconn.getConnection();
            st = conn.prepareStatement("SELECT team_id, sum(auton_top)*6 + sum(auton_middle)*4  + sum(auton_bottom)*2 as auton, sum(teleop_top)*3 + sum(teleop_middle)*2 + sum(teleop_bottom) + sum(teleop_pyramid)*5 as teleop, sum(pyramid_level)*10 as climb, sum(auton_top)*6 + sum(auton_middle)*4  + sum(auton_bottom)*2 + sum(teleop_top)*3 + sum(teleop_middle)*2 + sum(teleop_bottom) + sum(teleop_pyramid)*5 + sum(pyramid_level)*10 as total FROM match_record_2013 WHERE event_id = ? GROUP BY team_id");
            st.setInt(1, getSelectedEvent());
            rs = st.executeQuery();
            while (rs.next()) {
                JSONObject o = new JSONObject();

                o.put("id", rs.getInt("team_id"));
                o.put("autonomous", rs.getInt("auton"));
                o.put("teleop", rs.getInt("teleop"));
                o.put("climb", rs.getInt("climb"));
                o.put("total_points", rs.getInt("total"));
                json.add(o);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try{
                conn.close();
                st.close();
                rs.close();
            }catch (SQLException e) {
                System.out.println("Error closing query");
            }
        }
        return json.toString();
    }