title: Performing a relational Query and selecting distinct records by the combination of two columns in MySql
body: <p>I have two tables in my database, users and user activities, The user table has id, first_name,last_name and other fields, the user activities table has, id, user_id (foreign key --> from the users table) and project id. I want to select distinct user names (combination of first and last name) where project_id is 1.</p>
  
  <p>If I write this as a simple query it works fine, the query I wrote was:</p>
  
  <pre><code>SELECT DISTINCT users.first_name,users.last_name,`user_activities`.user_id FROM `users`
  JOIN `user_activities`
  ON users.id=`user_activities`.user_id 
  WHERE project_id=2;
  </code></pre>
  
  <p>How do i perform this query in YII? </p>