I have 2 tables, one is called Food while the other is FoodCategory. The relation between them is the FoodCatID which contain in both tables.
What I try to archive is displaying:
Meat
- Chicken
- Beef
Veg
- tomatoe
- potatoe
I assume I will need a query within a query? I first try to use Distinct to get the 2 unique FoodCatID:
Select Distinct FoodCategory.FoodCatID, FoodCategoryName
From Food INNER JOIN FoodCategory ON Food.FoodCatID = FoodCategory.FoodCatID
This will give me the 2 categories, but then how can I use the CatID to run the second part of the query?
I'm using this on a ColdFusion page, should I archive the result using SQL queries or can I do it through CF code?