1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/manual/new/docs/en/dql-doctrine-query-language/from-clause.txt
jepso 5329c3827c * Converted most of the docs to the new format.
* Fixed a few layout bugs in new documentation
* Fixed documentation table of contents indentation bug in IE6 (fixes #344)
* Fixed a parser bug in Sensei_Doc_Section
* Restructrured a bit some files of the documentation.
2007-06-13 21:30:32 +00:00

22 lines
998 B
Plaintext

Syntax:
<code>
FROM <component_reference> [[LEFT | INNER] JOIN <component_reference>] ...
</code>
The {{FROM}} clause indicates the component or components from which to retrieve records. If you name more than one component, you are performing a join. For each table specified, you can optionally specify an alias.
* The default join type is {{LEFT JOIN}}. This join can be indicated by the use of either {{LEFT JOIN}} clause or simply '{{,}}', hence the following queries are equal:
<code>
SELECT u.*, p.* FROM User u LEFT JOIN u.Phonenumber
SELECT u.*, p.* FROM User u, u.Phonenumber p
</code>
* {{INNER JOIN}} produces an intersection between two specified components (that is, each and every record in the first component is joined to each and every record in the second component). So basically {{INNER JOIN}} can be used when you want to efficiently fetch for example all users which have one or more phonenumbers.
<code>
SELECT u.*, p.* FROM User u INNER JOIN u.Phonenumber p
</code>