what is the relationship between the distance of a planet from the sun?
There is no connection between a planet's distance from the Sun and its rate of rotation (spin on its own axis or Planetary Rotation Period). While it is true that, generally speaking, the gas giants have higher rotation rates than the earth like planets closer to the Sun, any correlation is only coincidental.