Use count instead of select