It was good to find something that I didn't realise it existed in magento before today. Client had provided csv of products with only deepest child category. I needed to display product in that child category and it's parent categories above it.
I was almost going to write a script to assign a product to parent categories by looping through products and categories. Then found that magento can do this for you through Index Management.
I only needed to update was category's "Is Anchor" from "No" to "Yes" and then re-index the index item "category products" with description: "Indexed category/products association"
admin / Catalog / Categories / Manage Categories
admin / System / Index Management / Reindex category products