Re: How to tweak hierarchial SQL queries?

From: Jonathan Lewis <Jonathan_at_jlcomp.demon.co.uk>
Date: 1995/12/01
Message-ID: <817847597snz_at_jlcomp.demon.co.uk>#1/1


In article <NEWTNews.817690699.11000.bruce_at_ga.bst.bls.com>

           bruce.douglas_at_bridge.bst.bls.com "Bruce Douglas" writes:

: 1. Is there any way to affect the order in which "siblings" are returned? For
: example, we have a parent-child table containing locations. I'd like to see
: this result from a query:
:
: Arizona
: Phoenix
: Tempe
: Arkansas
: Fayetteville
: Little Rock
: Texarkana
: ...
:
: I can't get the "states" and "cities" to come back in alphabetical order.

Here's an idea, which I have not experimented with:

Given that the predicate for this type of query is:

        colA = prior colB

if you had an index on (colA, colB), then the join could be done by reference to that index, and the colB entries would automatically be in order.

-- 
Jonathan Lewis
Received on Fri Dec 01 1995 - 00:00:00 CET

Original text of this message