Here some code that works fine, but...
"SELECT b.*, c.publisher,
        CONCAT_WS(' ', first_name, last_name) AS Author
        FROM book AS b
        LEFT JOIN book_publisher as abc ON = abc.bookID
        LEFT JOIN publishers AS c ON abc.publishers_id =
        LEFT JOIN book_author AS ab ON = ab.bookID
        LEFT JOIN author AS a ON
        WHERE LEFT(last_name, 1 ) = '$Auth' ";
This works fine if there is only 1 author for the book; if there are two
they don't show up. I guess I can retrieve the authors from a separate
query, which is not a problem; I just thought it might be better to do
one query as that simplifies the rest of the code.
But doin just one query, would that put a heavier load on the db than
doing several queries?
I would like to modify things to get another Author in there. I had
hoped that it would be possible to do something like
CONCAT_WS(' ', first_name, last_name) WHERE ab.ordinal = 1 AS Author
CONCAT_WS(' ', first_name, last_name) WHERE ab.ordinal = 2 AS Author1
but MySQL doesn't like my creativity.
Or would it be better to join with first_name, last_name, ordinal and
then sort it out from the results...

unheralded genius: "A clean desk is the sign of a dull mind. "
Phil Jourdan ---

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to