What is difference between vitamin D2 and vitamin D3?

DEAR DOCTOR K: My doctor advised me to take a vitamin D supplement. Why do I need vitamin D? Also, my pharmacy sells vitamin D in two forms: D2 and D3. What is the difference, and which one should I take?
DEAR READER: This is an area full of controversy because not enough research has been done. I typically recommend getting vitamins from food, but vitamin D is found naturally in only a few foods. Fatty fish is the main dietary source, and milk, many juices and breakfast cereals are fortified with it. We get most of our vitamin D from the sun: When sunlight strikes the skin, skin cells make vitamin D. But these days, people get a lot less sunlight than they used to.