This is a discussion on hierarchy information within the MySQL forums, part of the Database Server Software category; --> How do I go about representing hierarchy information in a table? Do I use a field to determine it(say ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| How do I go about representing hierarchy information in a table? Do I use a field to determine it(say a "level" and use the position in the table to determine it) or is there a better way? essentially I am going to store "comments" and need to keep the heirarchy in some way but I'm not sure the "best" way. Seems like a waste to use an extra field but that might be the easiest. What I mean is that if I have something like 1 1.1 1.2 1.2.1 1.2.2 1.2.3 1.3 2 2.1 2.1.1 2.1.2 2.2 etc... so I could just store the "level" in the table. I won't have any need to remove rows so that might help. Thanks, Jon |
| |||
| On 14 Jun, 07:52, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote: > How do I go about representing hierarchy information in a table? Do I use a > field to determine it(say a "level" and use the position in the table to > determine it) or is there a better way? > > essentially I am going to store "comments" and need to keep the heirarchy in > some way but I'm not sure the "best" way. Seems like a waste to use an extra > field but that might be the easiest. > > What I mean is that if I have something like > > 1 > 1.1 > 1.2 > 1.2.1 > 1.2.2 > 1.2.3 > 1.3 > 2 > 2.1 > 2.1.1 > 2.1.2 > 2.2 > etc... > > so I could just store the "level" in the table. > > I won't have any need to remove rows so that might help. > > Thanks, > Jon Take a look at: http://dev.mysql.com/tech-resources/...ical-data.html |
| ||||
| "Captain Paralytic" <paul_lautman@yahoo.com> wrote in message news:1181810513.117378.34290@i38g2000prf.googlegro ups.com... > On 14 Jun, 07:52, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote: >> How do I go about representing hierarchy information in a table? Do I >> use a >> field to determine it(say a "level" and use the position in the table to >> determine it) or is there a better way? >> >> essentially I am going to store "comments" and need to keep the heirarchy >> in >> some way but I'm not sure the "best" way. Seems like a waste to use an >> extra >> field but that might be the easiest. >> >> What I mean is that if I have something like >> >> 1 >> 1.1 >> 1.2 >> 1.2.1 >> 1.2.2 >> 1.2.3 >> 1.3 >> 2 >> 2.1 >> 2.1.1 >> 2.1.2 >> 2.2 >> etc... >> >> so I could just store the "level" in the table. >> >> I won't have any need to remove rows so that might help. >> >> Thanks, >> Jon > > Take a look at: > http://dev.mysql.com/tech-resources/...ical-data.html > Thanks Jon |