Hi,
I have a database that has 2 tables - a list of documents and a list of authors. A document can have 0, 1 or more authors linked to it. I have a third table that keeps track of what authors are linked to what document.
I am trying to figure out the best way of producing an HTML table that has one row per document with two columns. In the first column I want the document title and in the 2nd column I want the authors. If there is more than one author I want them to appear in the same cell (i.e. on the same row).
I can write a query easily enough that produces a recordset that has the info I need but the code that keeps tack of whether to move onto the next row in the HTML table and whether to display the document name etc. is getting really untidy.
The other option is to load the documents into an array and then perform a SQL lookup for the authors for each row in the array but this would mean executing a lot of queries.
The other option is to load the documents and the authors into an array and then have a nested loop however I am wondering if this is inefficient as well - if I have 100 documents with 50 authors then this would be 5000 cycles to display 100 rows.
Are there any other options anyone can think of? Would be very grateful for any guidance.
Thanks very much
Ed Mozley
I have a database that has 2 tables - a list of documents and a list of authors. A document can have 0, 1 or more authors linked to it. I have a third table that keeps track of what authors are linked to what document.
I am trying to figure out the best way of producing an HTML table that has one row per document with two columns. In the first column I want the document title and in the 2nd column I want the authors. If there is more than one author I want them to appear in the same cell (i.e. on the same row).
I can write a query easily enough that produces a recordset that has the info I need but the code that keeps tack of whether to move onto the next row in the HTML table and whether to display the document name etc. is getting really untidy.
The other option is to load the documents into an array and then perform a SQL lookup for the authors for each row in the array but this would mean executing a lot of queries.
The other option is to load the documents and the authors into an array and then have a nested loop however I am wondering if this is inefficient as well - if I have 100 documents with 50 authors then this would be 5000 cycles to display 100 rows.
Are there any other options anyone can think of? Would be very grateful for any guidance.
Thanks very much
Ed Mozley