How to set Alias Name

Example Query





SELECT po.OrderID, p.LastName, p.FirstName

FROM Persons AS p,

Product_Orders AS po

WHERE p.LastName='Hansen' AND p.FirstName='Ola'



we could use base table as




$creteria->compare('t.OrderID',$this->OrderID,true);



but how we can use PO

You set up aliases in the model relations function.

So if you have this:


'po' => array(self::HAS_MANY, 'Product_Orders', 'OrderID'),

You can refer to it as ‘po’