WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Linux, UNIX, Open Source

Linux, UNIX, Open Source Rat & Tat bei Problemen und Fragen rund um GNU/Linux, BSD und sonstige UNIXe

Microsoft KARRIERECAMPUS

 
 
Themen-Optionen Ansicht
Alt 23.01.2002, 21:02   #2
PeterWoe
Senior Member
 
Registriert seit: 02.11.2001
Beiträge: 103


Standard

Aus den PostgreSQL FAQ:

PostgreSQL 7.1 and later supports outer joins using the SQL standard syntax. Here are two examples:

SELECT *
FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);

or
SELECT *
FROM t1 LEFT OUTER JOIN t2 USING (col);

These identical queries join t1.col to t2.col, and also return any unjoined rows in t1 (those with no match in t2). A RIGHT join would add unjoined rows of t2. A FULL join would return the matched rows plus all unjoined rows from t1 and t2. The word OUTER is optional and is assumed in LEFT, RIGHT, and FULL joins. Ordinary joins are called INNER joins.

In previous releases, outer joins can be simulated using UNION and NOT IN. For example, when joining tab1 and tab2, the following query does an outer join of the two tables:



SELECT tab1.col1, tab2.col2
FROM tab1, tab2
WHERE tab1.col1 = tab2.col1
UNION ALL
SELECT tab1.col1, NULL
FROM tab1
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY col1

Peter
____________________________________
Derselbe scharfe Verstand, der es uns ermöglicht, etwas Gutes zu schreiben, läßt uns auch fürchten, es könnte nicht gut genug sein, daß es verdient, gelesen zu werden.
La Bruyère
PeterWoe ist offline   Mit Zitat antworten
 


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 19:23 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag