PAD - PHP Application Driver


home | manual | reference | regression | sequence | develop | apps


Select/demo/join

PHP
select/demo/join.php
<?php

$padSelect
['table1'] = [ 'key' => 'key', 'fields' => ['key' => 'key1', 'text' => 'text1'] ];
$padSelect ['table2'] = [ 'key' => 'key', 'fields' => ['key' => 'key2', 'text' => 'text2'] ];
$padSelect ['table3'] = [ 'key' => 'key', 'fields' => ['key' => 'key3', 'text' => 'text3'] ];
$padSelect ['table4'] = [ 'key' => 'key', 'fields' => ['key' => 'key4', 'text' => 'text4'] ];

$padSelect ['join'] = [ 'base' => 'table1', 'join' => 'table2' ];

$padSelect ['inner'] = [ 'base' => 'table1', 'join' => [ 'inner' => 'table2', 'key'=> 'table1.key'] ];
$padSelect ['natural1'] = [ 'base' => 'table1', 'join' => [ 'natural' => 'table2' ] ];
$padSelect ['left'] = [ 'base' => 'table1', 'join' => [ 'left' => 'table2', 'key'=> 'table1.key'] ];
$padSelect ['natural2'] = [ 'base' => 'table1', 'join' => [ 'natural left' => 'table2' ] ];
$padSelect ['right'] = [ 'base' => 'table1', 'join' => [ 'right' => 'table2', 'key'=> 'table1.key'] ];
$padSelect ['natural3'] = [ 'base' => 'table1', 'join' => [ 'natural right' => 'table2' ] ];
$padSelect ['cross'] = [ 'base' => 'table1', 'join' => [ 'cross' => 'table2' ] ];

$padSelect ['multi'] = [ 'base' => 'table1', 'join' => [ ['inner' => 'table2', 'key'=> 'table1.key'],
[
'inner' => 'table3', 'key'=> 'table1.key'],
[
'inner' => 'table4', 'key'=> 'table1.key'] ] ];
?>
HTML
select/demo/join.pad
Result
<h1>Join demo</h1>

<h2>join</h2>

<table border=1>
{join}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
</tr>
{/join}
</table>

<h2>natural</h2>

<table border=1>
{natural1}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/natural1}
</table>

<h2>inner</h2>

<table border=1>
{inner}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/inner}
</table>

<h2>left</h2>

<table border=1>
{left}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/left}
</table>

<h2>natural left</h2>

<table border=1>
{natural2}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/natural2}
</table>

<h2>right</h2>

<table border=1>
{right}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/right}
</table>

<h2>natural right</h2>

<table border=1>
{natural3}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/natural3}
</table>

<h2>cross</h2>

<table border=1>
{cross}
<tr>
<td>{$key1}</td>
<td>{$text1}</td>
<td>{$key2}</td>
<td>{$text2}</td>
</tr>
{/cross}
</table>

<h2>multi</h2>

<table border=1>
{multi}
<tr>
<td>{$text3}</td>
<td>{$text4}</td>
</tr>
{/multi}
</table>

Join demo

join

11 Only in table 1
12 Only in table 1
21 In both tables
22 In both tables
11 Only in table 1
12 Only in table 1
21 In both tables
22 In both tables
11 Only in table 1
12 Only in table 1
21 In both tables
22 In both tables
11 Only in table 1
12 Only in table 1
21 In both tables
22 In both tables

natural

21 In both tables 21 In both tables
22 In both tables 22 In both tables

inner

21 In both tables 21 In both tables
22 In both tables 22 In both tables

left

21 In both tables 21 In both tables
22 In both tables 22 In both tables
11 Only in table 1
12 Only in table 1

natural left

21 In both tables 21 In both tables
22 In both tables 22 In both tables
11 Only in table 1
12 Only in table 1

right

21 In both tables 21 In both tables
22 In both tables 22 In both tables
31 Only in table 2
32 Only in table 2

natural right

21 In both tables 21 In both tables
22 In both tables 22 In both tables
31 Only in table 2
32 Only in table 2

cross

11 Only in table 1 21 In both tables
12 Only in table 1 21 In both tables
21 In both tables 21 In both tables
22 In both tables 21 In both tables
11 Only in table 1 22 In both tables
12 Only in table 1 22 In both tables
21 In both tables 22 In both tables
22 In both tables 22 In both tables
11 Only in table 1 31 Only in table 2
12 Only in table 1 31 Only in table 2
21 In both tables 31 Only in table 2
22 In both tables 31 Only in table 2
11 Only in table 1 32 Only in table 2
12 Only in table 1 32 Only in table 2
21 In both tables 32 Only in table 2
22 In both tables 32 Only in table 2

multi

Multi join 3 Multi join 4



home | manual | reference | regression | sequence | develop | apps

(c) 2003-2025 Herbert Groot Jebbink