@@ -1224,21 +1224,26 @@ <H4><A name="4.23">4.23</A>) Why are my subqueries using
1224
1224
< H4 > < A name ="4.24 "> 4.24</ A > ) How do I do an < I > outer</ I > join?< BR >
1225
1225
</ H4 >
1226
1226
1227
- < P > PostgreSQL 7.1 and later supports outer joins. Here is an
1228
- example:</ P >
1227
+ < P > PostgreSQL 7.1 and later supports outer joins. Here are two
1228
+ examples:</ P >
1229
+ < PRE >
1230
+ SELECT *
1231
+ FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
1232
+ </ PRE >
1233
+ or
1229
1234
< PRE >
1230
1235
SELECT *
1231
1236
FROM t1 LEFT OUTER JOIN t2 USING (col);
1232
1237
</ PRE >
1233
- This will join t1.col to t2.col, and return any unjoined rows in t1
1234
- with < SMALL > NULL </ SMALL > values for t2 columns. A
1235
- < SMALL > RIGHT </ SMALL > join would return unjoined rows of table t2. A
1236
- < SMALL > FULL </ SMALL > join would return unjoined rows from t1 and t2.
1237
- The word < SMALL > OUTER </ SMALL > is optional and is assumed in
1238
- < SMALL > LEFT </ SMALL > , < SMALL > RIGHT</ SMALL > , and < SMALL > FULL</ SMALL >
1239
- joins. Ordinary joins are called < SMALL > INNER</ SMALL > joins.< BR >
1240
- < BR >
1241
- In previous releases, outer joins can be simulated using
1238
+ These identical queries join t1.col to t2.col, and return any
1239
+ unjoined rows in t1. A < SMALL > RIGHT </ SMALL > join would return
1240
+ unjoined rows of table t2. A < SMALL > FULL </ SMALL > join would return
1241
+ unjoined rows from t1 and t2. The word < SMALL > OUTER </ SMALL > is
1242
+ optional and is assumed in < SMALL > LEFT </ SMALL > ,
1243
+ < SMALL > RIGHT</ SMALL > , and < SMALL > FULL</ SMALL > joins. Ordinary joins
1244
+ are called < SMALL > INNER</ SMALL > joins.</ P >
1245
+
1246
+ < P > In previous releases, outer joins can be simulated using
1242
1247
< SMALL > UNION</ SMALL > and < SMALL > NOT IN</ SMALL > . For example, when
1243
1248
joining < I > tab1</ I > and < I > tab2,</ I > the following query does an
1244
1249
< I > outer</ I > join of the two tables:< BR >
0 commit comments