Extracting data from multiple tables

  • Hello,

    Can anyone help me develop the query to extract data from multiple tables of the database.

    There is a form on the site which has a text filed to search books based on different conditions, one of which is "By Author". To extract all the books written by an author, 4 tables are involved:

    When the form is submitted, it first need to find the author's id number from the name submitted

    1. Table name "Authors" fields: authorid (eg. 55), firstname, lastname

    2. Having found the authorid, it now needs to find the books (bookids, eg. 45, 46, 47) written by the author in the table "AuthorBooks".

    3. Having found the bookids, it now needs to find the associated productid from the table "ProductNos". There are 2 columns in this table "bookids" which is same as the above table, the other column is "productid" like bookids 45 has associated productid = 47.

    4. Having found the productid, it now needs to find isbn, title, price from the table "ProductDetails", which will be shown on the webpage.

    Thanks.

  • This sounds an aweful lot like a homework question. Why don't you post the table DDL and the SQL code that you've written so far so we can help you learn as opposed to just doing the work for you. Post your attempt at writing the SQL and we can help guide you.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • .. as John posted, you need to help us also to provide you help.

    Read here Forum Etiquette: How to post data/code on a forum to get the best help[/url]

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply