Cosmological constraints from multiple tracers in spectroscopic surveys