What if my child both hates school and likes being in school with all his friends?

If neither option appeals to the child there are reasons for that. What are the reasons? There is a problem to solve. There will be something good that the child wants, and something bad that the child wants to avoid. We just need to find out what those things are, and start thinking laterally to come up with a solution that provides the good and not the bad.