Edit: Speculation tax applies within 10 years (to my knowledge, possibly outdated??!). So, you have to be a self-user for 10 years not to have to pay this tax.
No guarantee, but confirms it:
Commercial real estate (resp. not self-used) can be sold "tax-free" after 10 years or transferred to private assets. After another 10 years in private assets, the property(ies) can also be sold "tax-free" again.
If you use the property yourself, this is possible after 2 years. Otherwise, every private home builder would potentially be tied to their property for up to 10 years, which would have significant effects in other areas (e.g., labor market and thus also the construction industry).
Best regards
Dirk Grafe
P.S.: : I saw it too late, was directed to the first page ...