MySQL Forums
Forum List  »  Newbie

Re: Getting many to many queries to wsork
Posted by: Barry Galbraith
Date: July 18, 2024 05:08PM

I loaded your tables and this query executes without an error.
But without any data in the datas. I don't know if it returns the data you are looking for.
SELECT b.bk_title as title
, a.preferred_name as author_name -- can't use table name as alias
, a.last_name AS last_name
, a.suffix AS suffix
, b.bk_year as publish_date
, b.bk_edition as edition
, b.bk_type
, b.bk_isbn as isbn
, p.pub_name AS publisher_name -- can't use table name as alias.
FROM book b
JOIN author a
JOIN publisher p
JOIN bookauthor ba ON ba.book_id = b.book_id
JOIN bookauthor ON ba.author_id = a.author_id;
Please don't put spaces in alias names. e.g. 'Publish Date' That will only lead to heartache.
Alias names aren't quotes text strings.

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Getting many to many queries to wsork
July 18, 2024 05:08PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.