Changed sql query for getHomeworks