Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.56 KB

Join.md

File metadata and controls

50 lines (39 loc) · 1.56 KB

Used in Select, Update and Delete statements.

Constructor

__construct($table, Conditional $on, $type = "")

Parameter Description
$table The table to join against
$on Conditional to join the above table on
$type Optional type of join to perform

Example

use FaaPz\PDO\Clause\Conditional;
use FaaPz\PDO\Clause\Join;
use FaaPz\PDO\Clause\Raw;

// ... JOIN orders ON customers.id = orders.customer_id
$statement->join(new Join("orders",
    new Conditional("customers.id",  "=", new Raw("orders.customer_id"))
);

// ... INNER JOIN orders ON customers.id = orders.customer_id
$statement->join(new Join("orders",
    new Conditional("customers.id",  "=", new Raw("orders.customer_id")),
    "INNER"
);

// ... LEFT OUTER JOIN orders ON customers.id = orders.customer_id
$statement->join(new Join("orders",
    new Conditional("customers.id",  "=", new Raw("orders.customer_id")),
    "LEFT OUTER"
);

// ... RIGHT OUTER JOIN orders ON customers.id = orders.customer_id
$statement->join(new Join("orders",
    new Conditional("customers.id",  "=", new Raw("orders.customer_id")),
    "RIGHT OUTER"
);

// ... FULL OUTER JOIN orders ON customers.id = orders.customer_id
$statement->join(new Join("orders",
    new Conditional("customers.id",  "=", new Raw("orders.customer_id")),
    "FULL OUTER"
);