profwannabe
Programmer
I have tried to resolve this problem both using SQL and using various CF tricks to no avail. I am running an Access DB on a CF 4.5 platform.
I am generating a bibliography from a database. When a subject is selected (SubjectID) a list of books is generated using a subquery, as there is a many-to-many relationship between BiblioID and SubjectID. What I need to do is sort this list of books by the last name of the first listed author.
Some books have multiple authors, so I have a many-to-many relationship established (Tables: Biblio, Book_Author_Relationship, Authors). The problem is that I need to sort on the first author for each book (note: authors are not always listed alphabetically; there is a BAID primary key in the relationship table so that I can sort authors in order of entry rather than by authorID). For my output I then requery to get the full list of authors for each BiblioID. Although I have tried a variety of approaches, I cannot sort by AuthorLastName without getting multiple entries for books with multiple authors.
I have tried using SQL commands such as Group By, Distinct, and DistinctRow on Book_Author_Relationship.BookID with no luck. I have also tried to use the CF command Group, but that applies only after the query has sorted. I have tried creating an array of results from the Book_Author_Relationship table excluding multiple entries for a single book (due to multiple authors) using <cfif> but cannot think of how to then use that array for my output (since I need to requery to get the additional authors).
Not sure if CF or SQL is the best solution to this problem. Any advice would be greatly appreciated :-(
I am generating a bibliography from a database. When a subject is selected (SubjectID) a list of books is generated using a subquery, as there is a many-to-many relationship between BiblioID and SubjectID. What I need to do is sort this list of books by the last name of the first listed author.
Some books have multiple authors, so I have a many-to-many relationship established (Tables: Biblio, Book_Author_Relationship, Authors). The problem is that I need to sort on the first author for each book (note: authors are not always listed alphabetically; there is a BAID primary key in the relationship table so that I can sort authors in order of entry rather than by authorID). For my output I then requery to get the full list of authors for each BiblioID. Although I have tried a variety of approaches, I cannot sort by AuthorLastName without getting multiple entries for books with multiple authors.
I have tried using SQL commands such as Group By, Distinct, and DistinctRow on Book_Author_Relationship.BookID with no luck. I have also tried to use the CF command Group, but that applies only after the query has sorted. I have tried creating an array of results from the Book_Author_Relationship table excluding multiple entries for a single book (due to multiple authors) using <cfif> but cannot think of how to then use that array for my output (since I need to requery to get the additional authors).
Not sure if CF or SQL is the best solution to this problem. Any advice would be greatly appreciated :-(