Investors & landlords

OK. So say I keep it as my residence for a contiguous two year period from the last time I moved in would that be also non-qualified? Should I rent it for 6 months then sell it to get this loophole?