Jump to content

Newbie Needs Help with Formulating a Query


vincej

Recommended Posts

My table, 'Categories' featured below, has parent categories and child categories. A child category has a parent eg carrots (child) vegetable (parent).

 

I am trying to formulate a query which returns the *name* of the parent category rather than just the parent id and I am failing miserably. Parentid 0 is root category.

 

Many Many Thanks for you help !!

 

id 	name 	parentid
18 	Poultry 	0
19 	Beef 	0
20 	Chicken 	18
21 	Ribs 	19
22 	Fish 	0
23 	Salmon 	22
24 	Turkey 	18
26 	Community 	0
27 	Recent News 	26
28 	Honey 	0
29 	Organic Honey 	28
30 	Steaks 	19
31 	Scallops 	22

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.