Query builder

I am currently using this approach.

It seems to be very to understand the logic and that data that we are going to access.

It helps to write the better readable and understandable code.

Yes! clear and understandable

What about include LIMIT and ORDER BY clauses to the query builder for UPDATE operations?

The problem is that update() method doesnt returns CDbCommand itself, so you cant append other methods like order() and limit(). By the way, it would be nice to include at least that functionality as optional params of the update() method.

Right now i am using "createCommand(SQL SENTENCE)" for that kind of querys, but i prefer a cleaner way.

Any suggestions?

Thanks

help me with an example how to update using query builder pls I need this urgently…

The Definitive Guide to Yii » Working with Databases » Query Builder » Building Data Manipulation Queries

How to Slove to create DbCreateCommand ? when I have query :




SELECT a.* 

FROM employee a

WHERE a.emp_id not in (select b.emp_id from commet <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />



please help me

I tray to :




$hkmList=Yii::app()->db->createCommand()

->select('a.emp_id, a.emp_name')

->selectdistinct('a.emp_id')

->from('employee a')

->join('commet b','a.emp_id <> b.emp_id')					

//->order('a.emp_id, a.emp_name ASC')

->queryAll();



but this not work … wohto ?

… WELL I can slove my problem with This code :




$connect1 = Yii::app()->db;

$sql= "Select * from employee WHERE emp_id not in (select emp_id from commet)";

$command = $connect1->createCommand($sql);

$dataReader= $command->queryAll();



and I render data to my ACtion in controller

like This -->




$this->render('addList', array(

			//'models'=>Employee::model()->findAll($criteria),

			'models'=>$dataReader,	

			'form'=>$form,

			'hkmList'=>$dataReader,)



Thanks Yii, Yii is powerfull