Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002
    Posts
    12

    Unanswered: Beginners table JOIN question

    Hi,

    I'm trying to work out how to display data held in two seperate tables.

    Table one (biografias) lists names of artists and authors. Table 2 (productos) lists names of artworks and books. The artist / author ID is shared across both tables, but the artist / author name and the artwork / book name are contained only in each relevant table.

    What I've been trying to work out is how to join the two so that I can print out Book title by book author etc. but so far have been unable to find a tutorial simple enough for my low level. Can anyone point me in the right direction?

    Thanks,

    Gary Crighton

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    Table one (biografias) lists names of artists and authors. Table 2 (productos) lists names of artworks and books. The artist / author ID is shared across both tables, but the artist / author name and the artwork / book name are contained only in each relevant table.

    What I've been trying to work out is how to join the two so that I can print out Book title by book author etc. but so far have been unable to find a tutorial simple enough for my low level. Can anyone point me in the right direction?


    select Title = p.booktitle. Author = b.name
    from biografias b
    inner join productos p
    on b.authorID = p.authorID
    order by p.booktitle. b.name

  3. #3
    Join Date
    Feb 2002
    Posts
    12
    Hi,

    For the idiots like me, the simple (and more legible solution) was as follows:

    SELECT * FROM biografias, productos WHERE biografias.id = productos.id AND biografias.Tipo = 2 ORDER BY $order

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •