dbTalk Databases Forums  

outer join left + right?

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss outer join left + right? in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marten Lehmann
 
Posts: n/a

Default outer join left + right? - 05-01-2006 , 01:59 PM






Hello,

lets say I have two tables:

table1:
id (primary key)
data1

table2:
id (primary key)
data2

I want to have a result st as follows:

id, data1, data2

Both tables can contain records with the same id. It may be, that there
is a record for a certain id in both tables, or only in table1 or only
in table2. I know how to do this if table1 contains the records in every
case in table2 only in certain cases so I can use a left outer join. But
what does the query have to look like, if this can happen for both tables?

Regards
Marten

Reply With Quote
  #2  
Old   
Greg Fenton
 
Posts: n/a

Default Re: outer join left + right? - 05-01-2006 , 02:06 PM






Marten Lehmann wrote:
Quote:
Both tables can contain records with the same id. It may be, that there
is a record for a certain id in both tables, or only in table1 or only
in table2. I know how to do this if table1 contains the records in every
case in table2 only in certain cases so I can use a left outer join. But
what does the query have to look like, if this can happen for both tables?

Please, always post the version and build number of SQL Anywhere that
you are using.

Take a look at FULL OUTER JOIN. In the SQL Anywhere 9.x online docs, see:

ASA SQL User's Guide
Joins: Retrieving Data from Several Tables
Inner and outer joins
- Outer joins

greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.