Preparation of compounds having groups or groups