If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > outer joins problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-10, 13:05
millwall millwall is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
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!!!!!
Reply With Quote
  #2 (permalink)  
Old 11-15-10, 13:53
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,613
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.
Reply With Quote
  #3 (permalink)  
Old 11-15-10, 14:48
millwall millwall is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
pat
thanks for the attempt but it did not work
Reply With Quote
  #4 (permalink)  
Old 11-16-10, 09:17
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
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
Reply With Quote
  #5 (permalink)  
Old 11-18-10, 01:50
millwall millwall is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 11-18-10, 08:34
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On