title: joining two queries using join in mysql
body: <p>I have following two queries</p>
  
  <p>1)</p>
  
  <pre><code>SELECT  `domains`.`name` ,  `pageviews`.`domain_id` , COUNT(  `pageviews`.`domain_id` ) 
  FROM  `pageviews` 
  LEFT JOIN  `domains` ON (  `domains`.`id` =  `pageviews`.`domain_id` 
  AND  `domains`.`user_id` =  '129' ) 
  WHERE  `pageviews`.`user_id` =  '129'
  GROUP BY  `pageviews`.`domain_id` 
  ORDER BY COUNT(  `pageviews`.`domain_id` ) DESC 
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>SELECT  `domains`.`name` ,  `visitors`.`ip` ,  `visitors`.`domain_id` , COUNT(  `visitors`.`domain_id` ) 
  FROM  `visitors` 
  LEFT JOIN  `domains` ON (  `domains`.`id` =  `visitors`.`domain_id` 
  AND  `domains`.`user_id` =  '129' ) 
  WHERE  `visitors`.`user_id` =  '129'
  GROUP BY  `visitors`.`domain_id` 
  ORDER BY COUNT(  `visitors`.`domain_id` ) DESC
  </code></pre>
  
  <p>I want to combine these queries.
  this is required for cakephp pagination because i want to show data in table and want to sort acc. to visitors and pageviews if i want.
  associations are 1)  domains has many visitors   2) domains has many pageviews</p>