For Example :
SELECT tbl1.id FROM tbl1 a LEFT JOIN tbl1 b ON a.somecolumnname = b.somecolumn ORDER BY a.somecolumn DESC
The criteria would be as follow
$c=new Criteria();
$c->addAlias(‘a’, ‘tbl1’);
$c->addAlias(‘b’, ‘tbl1’);
$c->addSelectColumn(‘b.id’);
$c->addSelectColumn(‘a.tbl1_id’);
$c->addDescendingOrderByColumn(‘a.somecolumn’);
$c->addJoin(‘a.somecolumnname’,’b.somecolumn’,Criteria::LEFT_JOIN); // Specify your criteria LEFT, RIGHT or INNER
$rs = tbl1Peer::doSelect($c);
Thanks Cheers 🙂
Vinod Ram has been in Software Industry since 2006 and has experience of over 16 years in Software Development & Project Management domain specialised majorly in LAMP stack & Open Source Technology, building enterprise level Web based Application, Large Database driven and huge traffic Websites and Project Management.
He loves to write information articles and blog to share his knowledge and experience with the outside world and help people to find solution for their problems.