/ LJCPHPCodeDoc / LJCDataManagerLib / LJCSQLBuilder / GetJoinStatement


Parameters
$tableName - The request table name.
$joins - The Collection of Join objects.

Returns

The Join clause.

Syntax

PHP
public static function GetJoinStatement(string $tableName
, ?LJCJoins $joins) : ?string

Creates the join statement.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCDataManagerLib.php";
 
 $joins = new LJCJoins();
 $join = $joins->Add("JoinTableName");
 $join->JoinOns->Add("FromColumnName", "ToColumnName");
 $join->Columns->Add("JoinColumnName", "PropertyName", "ResultName");
 
 $tableName = "TableName";
 $schemaColumns = $dataManager->SchemaColumns;
 $sql = "select\r\n";
 $sql .= LJCSQLBuilder::SQLColumns($tableName, $schemaColumns
   , joins: $joins);
 $sql .= "from $tableName \r\n";
 $sql .= LJCSQLBuilder::GetJoinStatement($tableName, $joins);

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.