Sort Order (ASP, Access) - TechRepublic
General discussion
January 24, 2003 at 11:22 AM
mr. origami

Sort Order (ASP, Access)

by mr. origami . Updated 23 years, 5 months ago

How is sorting applied? If I have a recordset and it’s ORDERED BY a column, how is it ordered after that column? Here’s what I mean:
Table = tblProducts
Fields = AutoID, Product, Color
Data:
1,Socks,red
2,Tutu,red
3,Socks,blue
4,Socks,green
5,Tutu,white

Now – if I order by PRODUCT (SELECT * FROM tblProducts ORDER BY Product), then I’ll get:
Socks
Socks
Socks
Tutu
Tutu

But – HOW ARE THE SOCKS ORDERED? Does the Red sock come before the Blue sock? Are they ordered by the AutoID,by the color, randomly? Is it possible to define a “2nd” sort order, a 3rd, and so on…?

This discussion is locked

All Comments