Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Unanswered: outer joins problems

    I am using open office base, the latest version, and wish to amalgamate three outer joins, one left and two right

    SELECT * FROM `Persons` LEFT JOIN `Address` ON `Persons`.`Address_id` = `Address`.`Address_id`

    SELECT `Email`.*, `Persons`.* FROM { OJ `Email` RIGHT OUTER JOIN `Persons` ON `Email`.`Person_id` = `Persons`.`Person_id` }

    SELECT * FROM { OJ `Telephone numbers` RIGHT OUTER JOIN `Persons` ON `Telephone numbers`.`Person_id` = `Persons`.`Person_id` }

    I have tried for most of today to resolve this problem I cannot do it. Any ideas anyone please!!!!!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This is pure "air code" and untested since I don't have a copy of Open Office at this location, but I'd start with:
    Code:
    SELECT *
       FROM `Persons`
       LEFT OUTER JOIN `Address` ON `Address`.`Address_id` = `Persons`.`Address_id`
       LEFT OUTER JOIN OJ `Email' ON `Email`.`Person_id` = `Persons`.`Person_id`
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Dec 2004
    Posts
    3
    pat
    thanks for the attempt but it did not work

  4. #4
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    what was it that did not "work" did not give you what you wanted? syntax error? What Pat gave you is almost how you would write SQL to get the info as you requested. Your statement does nothing for those of us that could offer assistance to you.

    Dave Nance

  5. #5
    Join Date
    Dec 2004
    Posts
    3

    out join stuff

    i copied and pasted the code into base and got the error message
    "syntax error in sql expression

  6. #6
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    well as Pat said it was off the top of his head and may not work exactly as it was. Something like this should work and stop selecting all cols.

    Code:
    SELECT p.some_cols
         , addr.some_cols
         , e.some_cols
         , tn.some_cols
       FROM Persons p
    LEFT OUTER JOIN Address addr
        ON Addr.Address_id = P.Address_id
    LEFT OUTER JOIN Email e
        ON E.Person_id = P.Person_id
    LEFT OUTER JOIN Telephone_numbers tn
        ON tn.Person_id = P.Person_id

Posting Permissions

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