|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
tree sort??will be accessing this data using msde with the data imported from an xml dump from another program... other possibilities are from the same xml imported to access, or directly with and odbc driver for xml. So stored proceedures are probably not an option, and some newer fancy stuff may not work either. So the question is, can this be done with basic sql on one of those combinations??? table is set up like: From To d4 e5 b2 c3 d4 f6 g7 h8 a1 b2 c3 d4 f6 g7 the data can be arbitrary alpha numerics, it has no relation to the final order or relation of the data to each other. The final result must sort the data to put the tree in order from top to bottom like: From To a1 b2 b2 c3 c3 d4 d4 e5 d4 f6 f6 g7 g7 h8 Or even better would be a single column in order Tree a1 b2 c3 d4 e5 f6 g7 h8 (where the order of children of the same node doesn't matter, so e5 and f6 could be reversed) any ideas? Dave,
Is it not possible to take the left of the string and sort based on that? - Augustin Show quote "d***@bigcompany.com" wrote: > I am unfortunately limited in what i can control in this case. At best i > will be accessing this data using msde with the data imported from an xml > dump from another program... other possibilities are from the same xml > imported to access, or directly with and odbc driver for xml. So stored > proceedures are probably not an option, and some newer fancy stuff may not > work either. > > So the question is, can this be done with basic sql on one of those > combinations??? > > table is set up like: > From To > d4 e5 > b2 c3 > d4 f6 > g7 h8 > a1 b2 > c3 d4 > f6 g7 > > the data can be arbitrary alpha numerics, it has no relation to the final > order or relation of the data to each other. The final result must sort the > data to put the tree in order from top to bottom like: > > From To > a1 b2 > b2 c3 > c3 d4 > d4 e5 > d4 f6 > f6 g7 > g7 h8 > > Or even better would be a single column in order > Tree > a1 > b2 > c3 > d4 > e5 > f6 > g7 > h8 > (where the order of children of the same node doesn't matter, so e5 and f6 > could be reversed) > any ideas? no, maybe i should have been more random in my picking of data... the strings
a1, b2, c3, could be any random alpha numerics. i.e. From To 123 12 12 987 987 55 55 444 444 999 or: tree 123 12 987 55 444 999 could be the final proper sort order for a different set of data. Show quote "Augustin Prasanna" wrote: > Dave, > > Is it not possible to take the left of the string and sort based on that? > > - Augustin > > "d***@bigcompany.com" wrote: > > > I am unfortunately limited in what i can control in this case. At best i > > will be accessing this data using msde with the data imported from an xml > > dump from another program... other possibilities are from the same xml > > imported to access, or directly with and odbc driver for xml. So stored > > proceedures are probably not an option, and some newer fancy stuff may not > > work either. > > > > So the question is, can this be done with basic sql on one of those > > combinations??? > > > > table is set up like: > > From To > > d4 e5 > > b2 c3 > > d4 f6 > > g7 h8 > > a1 b2 > > c3 d4 > > f6 g7 > > > > the data can be arbitrary alpha numerics, it has no relation to the final > > order or relation of the data to each other. The final result must sort the > > data to put the tree in order from top to bottom like: > > > > From To > > a1 b2 > > b2 c3 > > c3 d4 > > d4 e5 > > d4 f6 > > f6 g7 > > g7 h8 > > > > Or even better would be a single column in order > > Tree > > a1 > > b2 > > c3 > > d4 > > e5 > > f6 > > g7 > > h8 > > (where the order of children of the same node doesn't matter, so e5 and f6 > > could be reversed) > > any ideas?
Show quote
"d***@bigcompany.com" <davebigcompany***@discussions.microsoft.com> wrote in If the data can be "random", then how do you know what the correct order is?message news:99BC403B-95A7-449D-870B-2146F61C3429@microsoft.com... > no, maybe i should have been more random in my picking of data... the strings > a1, b2, c3, could be any random alpha numerics. > i.e. > > From To > 123 12 > 12 987 > 987 55 > 55 444 > 444 999 > > or: > > tree > 123 > 12 > 987 > 55 > 444 > 999 > > could be the final proper sort order for a different set of data. > > "Augustin Prasanna" wrote: > > > Dave, > > > > Is it not possible to take the left of the string and sort based on that? > > > > - Augustin > > > > "d***@bigcompany.com" wrote: > > > > > I am unfortunately limited in what i can control in this case. At best i > > > will be accessing this data using msde with the data imported from an xml > > > dump from another program... other possibilities are from the same xml > > > imported to access, or directly with and odbc driver for xml. So stored > > > proceedures are probably not an option, and some newer fancy stuff may not > > > work either. > > > > > > So the question is, can this be done with basic sql on one of those > > > combinations??? > > > > > > table is set up like: > > > From To > > > d4 e5 > > > b2 c3 > > > d4 f6 > > > g7 h8 > > > a1 b2 > > > c3 d4 > > > f6 g7 > > > > > > the data can be arbitrary alpha numerics, it has no relation to the final > > > order or relation of the data to each other. The final result must sort the > > > data to put the tree in order from top to bottom like: > > > > > > From To > > > a1 b2 > > > b2 c3 > > > c3 d4 > > > d4 e5 > > > d4 f6 > > > f6 g7 > > > g7 h8 > > > > > > Or even better would be a single column in order > > > Tree > > > a1 > > > b2 > > > c3 > > > d4 > > > e5 > > > f6 > > > g7 > > > h8 > > > (where the order of children of the same node doesn't matter, so e5 and f6 > > > could be reversed) > > > any ideas? Is there some auxiliary table where you define that?
Show quote
"Jeremy Williams" wrote: the order of the data i am supplied can be random. the problem is to sort > > "d***@bigcompany.com" <davebigcompany***@discussions.microsoft.com> wrote in > message news:99BC403B-95A7-449D-870B-2146F61C3429@microsoft.com... > > no, maybe i should have been more random in my picking of data... the > strings > > a1, b2, c3, could be any random alpha numerics. > > i.e. > > > > From To > > 123 12 > > 12 987 > > 987 55 > > 55 444 > > 444 999 > > > > or: > > > > tree > > 123 > > 12 > > 987 > > 55 > > 444 > > 999 > > > > could be the final proper sort order for a different set of data. > > > > "Augustin Prasanna" wrote: > > > > > Dave, > > > > > > Is it not possible to take the left of the string and sort based on > that? > > > > > > - Augustin > > > > > > "d***@bigcompany.com" wrote: > > > > > > > I am unfortunately limited in what i can control in this case. At > best i > > > > will be accessing this data using msde with the data imported from an > xml > > > > dump from another program... other possibilities are from the same xml > > > > imported to access, or directly with and odbc driver for xml. So > stored > > > > proceedures are probably not an option, and some newer fancy stuff may > not > > > > work either. > > > > > > > > So the question is, can this be done with basic sql on one of those > > > > combinations??? > > > > > > > > table is set up like: > > > > From To > > > > d4 e5 > > > > b2 c3 > > > > d4 f6 > > > > g7 h8 > > > > a1 b2 > > > > c3 d4 > > > > f6 g7 > > > > > > > > the data can be arbitrary alpha numerics, it has no relation to the > final > > > > order or relation of the data to each other. The final result must > sort the > > > > data to put the tree in order from top to bottom like: > > > > > > > > From To > > > > a1 b2 > > > > b2 c3 > > > > c3 d4 > > > > d4 e5 > > > > d4 f6 > > > > f6 g7 > > > > g7 h8 > > > > > > > > Or even better would be a single column in order > > > > Tree > > > > a1 > > > > b2 > > > > c3 > > > > d4 > > > > e5 > > > > f6 > > > > g7 > > > > h8 > > > > (where the order of children of the same node doesn't matter, so e5 > and f6 > > > > could be reversed) > > > > any ideas? > > If the data can be "random", then how do you know what the correct order is? > Is there some auxiliary table where you define that? > > it into the right order so that any given value in the 'to' column is always before the first time that value shows in the 'from' column. |
|||||||||||||||||||||||