Comparing energy in production of solar cells verses other energy sources

On a PBS show once someone claimed alot of energy goes into making solar cells. As well some heavy toxic metals. I suppose if batteries, thats a issue of energy in production toxic metals etc too. How might that compare with the energy garnered over the life of the product or with the energy of extracting, transporting, and making power plants (and maintaining/replacing) for .. coal? I wonder how many toxic metals go into all that.

Then theres the nonphotovoltaic solar cells which I know less about. You know the ones used simply to transfer the heat of the sun to other locations. I suppose that uses water pipes like your floor heating system. How does that compare with the rest of this, how efficient is that?


Another factor in

Another factor in electricity production is since solar energy is made on site when from photovoltaic cells, you don't lose energy in transmission and need for powerlines is reduced.

But then what about wind power? A fair amount of energy must go into those massive windmills. And because they arent usually put in the towns the energy has to travel a bit too (more electricty piplines and energy lost from distance)