title: Query 2 tables from 2 machines and group results
body: <p>I have a query that gives the right information back but I cannot figure out how to get distinct days and sum the count.  below is my query and the results shows what I get back, and what I would like to have come back.  I thought the union would join them and give my back the results that I wanted.  I have search for quite some time and have not located any help on this topic.  Any help will be appreciated.  Thank you in advance.</p>
  
  <pre><code>SELECT COUNT(log_datetime) AS icount, CONVERT(varchar, log_datetime, 101) AS logdate
  from openrowset('sqloledb', 'ServerName1';'UserID';'Password',
            'select * from DatabaseName..TableName where field1 &gt; 899')
  group by convert(varchar, log_datetime, 101)
  union
  SELECT COUNT(log_datetime) AS icount, CONVERT(varchar, log_datetime, 101) AS logdate
  from openrowset('sqloledb', 'ServerName2';'UserID';'Password',
      'select * from DatabaseName..TableName where field1 &gt; 899')
  group by convert(varchar, log_datetime, 101)
  order by logdate
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>Results
  235     01/10/2013
  312     01/10/2013
  3091    01/11/2013
  3197    01/11/2013
  3339    01/12/2013
  3536    01/12/2013
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>Wanted Results
  547      01/10/2013
  6288     01/11/2013
  6875     01/12/2013
  </code></pre>