Nested Queries In Sql

i want to implement a nested query in sql and get the data from that ,

$data=Statement::model()->findAllByAttributes(array(‘created_by’=>Yii::app()->session[“id”]));

now i want to get all the rows from the images database from the id returned from this query.