Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-5) was last changed on 10-Jul-2017 13:21 by BlakeMcBride

This page was created on 02-May-2011 21:13 by UnknownAuthor

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 49 added 4 lines
INSERT INTO table (col1, col2, col3)
SELECT col1, col2, col3
FROM ...
At line 55 added 42 lines
!Joining Tables
New (SQL92) syntax:
{{{
select * from table1 a
[inner] join table2 b
on a.fld1 = b.fld2;
}}}
"inner" is defaulted or implied.
inner joins exclude records that don't contain matches.
outer joins include rows with missing matches and provides nulls for the missing data.
"left outer" means the left side of the ON clause is the driving table (or the table that must have data to create a record).
"right outer" means the table on the right of the ON clause is the driving table (or the table that must have data to create a records).
{{{
select * from table1 a
left outer join table2 b
on a.fld1 = b.fld2;
}}}
Basically you should always use the table in the FROM clause on the left side and use a LEFT OUTER join.
If the field names in each table are the same you can use:
{{{
select * from table1 a
[inner] join table2 b
using (fld);
}}}
You can also join to the result of another query (a sub-query). In this case table2 would be replaced with {{{(select ...)}}}.
The joined table can also be the same table, i.e. table1 joins to table1.
Version Date Modified Size Author Changes ... Change note
5 10-Jul-2017 13:21 3.083 kB BlakeMcBride to previous
4 10-Jul-2017 13:20 3.109 kB BlakeMcBride to previous | to last
3 17-Nov-2015 12:03 3.007 kB BlakeMcBride to previous | to last
2 06-May-2013 11:24 3.006 kB BlakeMcBride to previous | to last
1 02-May-2011 21:13 1.869 kB UnknownAuthor to last
« This page (revision-5) was last changed on 10-Jul-2017 13:21 by BlakeMcBride