Results 1 to 2 of 2

Thread: Advanced Ordering

  1. #1
    Daniel Rönnqvist Guest

    Advanced Ordering

    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.

  2. #2
    Paul Guest

    Advanced Ordering (reply)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •