Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order By Questin

Status
Not open for further replies.

dhulbert

Technical User
Jun 26, 2003
1,136
GB

If I have a number of records returned from a query, and the resut set has an order by clause, what happens when 2 or more rows meet the same criteria

for example

ColA Colb ColC
A 1 Z
B 1 Y
C 2 X
C 2 W


If I Order By ColA, ColB then which way round would the 2 C rows be returned?

I have a feeling they will be returned in the order they are read from the source table but I just want to confirm it.

Cheers.

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
The sequence is undefined. It will probably/usually be in the sequence the rows were created, or based on an index, but if the sequence matters you need to ensure that your order by clause includes all appropriate fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top