On Tue, Aug 27, 2019 at 3:38 PM dboland9 <dbola...@protonmail.com> wrote:

> I need some help writing some queries for a MTM relationship.  The example
> tables are:
>
> author table         books table         author_books table
>     author_id PK        book_isbn PK        a_b_id PK
>     author_fname        book_title          author_id FK
>     author_lname        book_pub_date       book_isbn FK
>     author_minit
>
>
> Listings desired:
>     book_isbn   book_title  book_pub_date   author
>     ----------+------------+--------------+-----------
>
>     author     book_isbn    Book_title
>     --------+-------------+------------
>
> Would appreciate the query (inner join - that I do know), and why so I can
> learn something from them.  Please keep them simple (no alias or other
> shortcuts) so I can easily follow what you are doing.  Thanks in advance.
>

Well, that's all you need, inner join, just two of them. Nothing difficult
here IMHO. Or I'm missing something. --DD


> I assume the query will be something like:
>   SELECT
>     books.book_isbn, books.book_title, books.book_pub_date,
>     author.author_fname, author.author_minit,
>     author.author_lname
>   FROM books
>   JOIN
>     author_books ON (something )


select author.*, books.*
  from author_books
  join author on author.author_id  = author_books.author_id
  join books  on books.book_isbn   = author_books.book_isbn
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to