why the result of the query is in asending order



hi

i am facing one problem

i am having two table location and routesegment

location table having locationid as primary key.

routesegment having startlocation and endlocation and other columns.


routesegment table is

rsid rid distance
sloc eloc
---------------------------------------------------------
94 10 1.0700000431388617 20 25 1
95 10 0.15000000596046448 25 24 1
96 10 1.6400000620633364 24 27 1
97 10 0.12000000476837158 27 26 1
98 10 0.54000001028180122 26 28 1


rsid=routesegmentid
rid=routeid
sloc=startlocation
eloc=endlocation


i am firing one query which shows the locationname and locationid

query is

SELECT
distinct locationname,locationid
FROM
routesegment
,location

WHERE
(startlocation=locationid
or
endlocation=locationid)
and
routeid=@routeid(lets take 126)

(resul of query is as follows ,which is not desirable)

locationname locationid
---------------------------------------
Gallery 20
loc1 24
loc2 25
WP1 26
WP2 27
wp3 28


i want my result to be

in the following way(which is the actual order in routesegment : desirable)


locationname locationid
---------------------------------------
Gallery 20
loc2 25
loc1 24
WP2 27
WP1 26
wp3 28


why the result of the query is in asending order

is ther any solution

waiting for reply


thanks in advance

regards

Pravin




.