Home All Groups Group Topic Archive Search About
Author
11 Aug 2006 11:00 AM
dave@bigcompany.com
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?

Author
11 Aug 2006 12:42 PM
Augustin Prasanna
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?
Author
11 Aug 2006 1:41 PM
dave@bigcompany.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.

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?
Author
11 Aug 2006 4:13 PM
Jeremy Williams
Show quote
"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?
Author
11 Aug 2006 5:03 PM
dave@bigcompany.com
Show quote
"Jeremy Williams" wrote:

>
> "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?
>
>
the order of the data i am supplied can be random.  the problem is to sort
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.

AddThis Social Bookmark Button