title: Categories and Subcategories - How to Design Database
body: <p>So I am creating a database that has a Category, sub categories, sub sub categories, sub sub sub categories... you get the point, it  can go on forever.</p>
  
  <p>So I made a table.
  Category
  Name|ParentID|ID|Budget|</p>
  
  <p>For the sake of explaining my situation, I will pretend each category has a budget.
  How would I make a Select statement that is able to get the total budget for a category and its sub categories and their sub categories. This also means that when I enter into a sub category I should also be able to see the total budget of its own sub categories.</p>
  
  <p>Any advice will help me greatly! </p>
  
  <p>Thanks guys!</p>
  
  <p>Edit: I forgot to mention, the database is MySQL. I will be displaying the data on a webpage using PHP.</p>