0

CGridView を使用して車両モデルを表示しようとしています。

Fld7465RRef 参照列の値を表示するには、次の sql select が必要です。

select VUF._Fld7468_S as Loading_Time_To_DLR  
FROM Vehicles as Vehicles  
left join (_InfoReg7464 as VUF                 
inner join _Chrc7246 as CFU
on VUF._Fld7467RRef = CFU._IDRRef                  
and CFU._Description ='Vehicle uploading for DLRTime')                 
on Vehicles._IDRRef =  VUF._Fld7465RRef

このクエリの関係を構築するための解決策が見つかりません。

4

1 に答える 1

2

それを行う1つの方法はDAOです:

$mySqlString = "
    select VUF._Fld7468_S as Loading_Time_To_DLR  
    FROM Vehicles as Vehicles  
    left join (_InfoReg7464 as VUF                 
    inner join _Chrc7246 as CFU
    on VUF._Fld7467RRef = CFU._IDRRef                  
    and CFU._Description ='Vehicle uploading for DLRTime')                 
    on Vehicles._IDRRef =  VUF._Fld7465RRef
";
$command = Yii::app()->db->createCommand($mySqlString); 
$aResult = $command->query()->readAll();

もちろん、パラメーターがある場合は、次のようなステートメントでバインドする必要があります。

$command->bindParam(":userID", $userID, PDO::PARAM_STR);

もう1つの方法はクエリビルダーです

于 2013-01-11T08:40:54.317 に答える