as long as the table is included in the from part of your SQL you can order by any of the fields in it regardless of whether they are in the Select part.


------------
Daniel Rönnqvist at 3/5/01 5:56:57 AM

Hello.
I want to order a resultset from a table by two columns in another table. Here's how it looks:

[Books]
ID
Title


[linkBookAuthor]
BookID (Books.ID)
AuthorID (Authors.ID)

[Authors]
ID
Firstname
Lastname
AuthorOrder

As you can see it's a many to many relationship. Is there a way to order the books by Authors.Lastname (the first if there are several authors) with one query ? If not, what is the fastest way ? I don't need the names in the resultset so I only want to order the books by Authors.Lastname, not include Authors.Lastname.

Thanks for any help.