title: Yii relational database with not working
body: <p>I have this piece of code on my UsersController</p>
  
  <pre><code>$userModel = Users::model()-&gt;with('userSubscriptionTypes')-&gt;find(array(
              'order'=&gt;'userSubscriptionTypes.idUserSubscriptionType DESC',
              'limit'=&gt;1,
              'condition'=&gt;'t.paypal_profile_id=:paypal_profile_id', 
              'params'=&gt;array(':paypal_profile_id'=&gt;'I-S09AAFCLHH57')
          ));
  </code></pre>
  
  <p>This is giving me error:</p>
  
  <pre><code>CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'userSubscriptionTypes.idUserSubscriptionType' in 'order clause'. The SQL statement executed was: SELECT `t`.`idUser` AS `t0_c0`, `t`.`username` AS `t0_c1`, `t`.`password` AS `t0_c2`, `t`.`email_address` AS `t0_c3`, `t`.`firstname` AS `t0_c4`, `t`.`lastname` AS `t0_c5`, `t`.`isAdmin` AS `t0_c6`, `t`.`paypal_profile_id` AS `t0_c7`, `t`.`date_created` AS `t0_c8` FROM `users` `t` WHERE (t.paypal_profile_id=:paypal_profile_id) ORDER BY userSubscriptionTypes.idUserSubscriptionType DESC LIMIT 1 
  </code></pre>
  
  <p>It seems the <code>with</code> is not working basing on the SQL code snippet that the error gave.</p>
  
  <p>This is the <code>Users.php</code> relations Model code:</p>
  
  <pre><code>public function relations()
  {
          // NOTE: you may need to adjust the relation name and the related
          // class name for the relations automatically generated below.
          return array(
              'trackedItems' =&gt; array(self::HAS_MANY, 'TrackedItems', 'idUser'),
              'userSubscriptionTypes' =&gt; array(self::HAS_MANY, 'UserSubscriptionType', 'idUser'),
          );
  }
  </code></pre>
  
  <p>What is wrong with this one? And ideas?</p>
  
  <p>Thanks!</p>