Ok, so I have a table with TaskID and ChildOf as fields… so …
TaskID is Unique and Auto-Increment
If ChildOf == 0, then it has no Parent (top tier)...
If ChildOf != 0, then it is assigned TaskId of its Parent
Question: How to form a query to give the results like this …
Parent Task
Child Task
Child Task
Parent Task
Child Task
Etc.. etc...
Would it be easier if I use two tables? I’m going to have a lot of items in this table so I want to use as few queries (loops) as possible.
Any help is greatly appreciated.
Thanks
I think there is one way by which you have to just do soting without using join….
this is as follow –
this will give desired output…
means parent node and then respective child node…
and then second parent node and so on..
one thing I don’t know whether docode function runs on my sql as well or not..
if not then you can use following query –