There is no question here.
If you are asking how you deal with categories and sub categories, you can do this in several ways.
An easy way is just to check if there is a sub category or not. If there is, use that information in your view. If there is not, use the category information (if any - it is always possible that a product is not listed for a category or a sub category).
You do not need the 'has sub category' column. You lookup the category, then you look for subcategories. If none found it has no sub categories, if some found, then it has. I presume you have a category parent column so you know which parent a subcategory belongs to.
Paul.