Firebird 2.1 Language Reference Update
Firebird 2.1 Language Reference Update
Firebird 2.1 Language Reference Update
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Example:<br />
select * from Men cross join Women<br />
order by Men.age, Women.age<br />
DML statements<br />
-- old syntax:<br />
-- select * from Men join Women on 1 = 1<br />
-- order by Men.age, Women.age<br />
-- comma syntax:<br />
-- select * from Men, Women<br />
-- order by Men.age, Women.age<br />
Named colums JOIN<br />
Added in: <strong>2.1</strong><br />
Description: A named colums join is an equi-join on the columns named in the USING clause. These columns<br />
must exist in both relations.<br />
Syntax:<br />
Example:<br />
Notes:<br />
SELECT ...<br />
FROM [] JOIN <br />
USING (colname [, colname ...])<br />
...<br />
::= {table | view | cte | (select_stmt)} [[AS] alias]<br />
::= INNER | {LEFT | RIGHT | FULL} [OUTER]<br />
select *<br />
from books join shelves<br />
using (shelf, bookcase)<br />
The equivalent in traditional syntax:<br />
select *<br />
from books b join shelves s<br />
on b.shelf = s.shelf and b.bookcase = s.bookcase<br />
• The columns in the USING clause can be selected without qualifier. Be aware, however, that doing so in outer<br />
joins doesn't always give the same result as selecting left.colname or right.colname. One of the latter<br />
may be NULL while the other isn't; plain colname always returns the non-NULL alternative in such cases.<br />
• SELECT * from a named columns join returns each USING column only once. In outer joins, such a column<br />
always contains the non-NULL alternative except for rows where the field is NULL in both tables.<br />
Natural JOIN<br />
Added in: <strong>2.1</strong><br />
76