PHP |
---|
public static function CreateSelect(string $tableName , LJCDbColumns $schemaColumns, ?LJCDbColumns $keyColumns , array $propertyNames = null, ?LJCJoins $joins = null) : string |
PHP |
---|
$webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon"; require_once "$webCommonPath/LJCDataManagerLib.php"; require_once "$webCommonPath/LJCDBAccessLib.php"; $schemaColumns = new LJCDbColumns(); $schemaColumns->Add("ID", null, "int"); $schemaColumns->Add("Name"); $keyColumns = new LJCDbColumns(); $keyColumns->Add("ID", value:1); array $propertyNames = []; $propertyNames[] = "ID"; $propertyNames[] = "Name"; $joins = new LJCJoins(); $join = $joins->Add("JoinTableName"); $join->JoinOns->Add("FromColumnName", "ToColumnName"); $join->Columns->Add("JoinColumnName", "PropertyName", "ResultName"); $sql = LJCSQLBuilder::CreateSelect("TableName", $schemaColumns , $keyColumns, $propertyNames, $joins); // $sql = // select // TableName.ID, // TableName.Name // JoinTableName.JoinColumnName as ResultName // from TableName; // left join JoinTableName // on ((TableName.FromColumnName = JoinTableName.ToColumnName)) // where TableName.ID = 1 |