title: MVC Complex query and model usage
body: <p>I have 3 tables. </p>
  
  <ul>
  <li>users, </li>
  <li>campaigns, </li>
  <li>links. </li>
  </ul>
  
  <p>They have <em>one-to-many</em> relations. User have many campaigns. Campaign has many links. </p>
  
  <p>I calculate top users by counting the total number of links  each user have. So I join 3 tables and group by user and select user and sum(links). </p>
  
  <p>This query involves  3 tables. I have already 3 model class for each of these tables. Now my question is in which model should I put this query? should it go in User model (as I call it <em>top10users</em>? Or there is other way to get this info by utilizing already existing 3 models. I want to know what is most suitable from MVC's point of view.</p>
  
  <h3>Additional Information</h3>
  
  <p>I am using <a href="/questions/tagged/orm" class="post-tag" title="show questions tagged 'orm'" rel="tag">orm</a> in <a href="/questions/tagged/kohana" class="post-tag" title="show questions tagged 'kohana'" rel="tag">kohana</a>. </p>
  
  <p>Query:</p>
  
  <pre><code>SELECT u.id, 
         u.name, 
         SUM(l.num_visited) total_num_visited 
  FROM   users u 
         JOIN campaigns c 
           ON ( u.id = c.user_id ) 
         JOIN links l 
           ON ( c.id = l.campaign_id ) 
  GROUP  BY u.id 
  ORDER  BY total_num_visited DESC 
  LIMIT  10;
  </code></pre>