title: Connecting to Excel ODBC
body: <p>I have the below query and I was wondering how to setup an ODBC connection to get this to an excel spreadsheet.    </p>
  
  <pre><code>declare @StartDate DATE
  declare @EndDate   DATE
  
  SELECT Sum(case when status = 6 then 1 else 0 end) as Failed,
     Sum(case when status = 9 then 1 else 0 end) as Successful,
     UniqueID
  Into #tempsheet1
  FROM Documents
  WHERE ownerID = 467
  and status in (6,9)
  and CreationTime between @StartDate and @EndDate
  Group By UniqueID
  
  Select D.UniqueID, FromName, ToName, CreationTime,
  cast(CreationTime as date) as CreationDate, cast(CreationTime as date) as CreationTime,
  ErrorCode, ElapsedSendTime, RemoteID
  From #tempsheet1 ts1
  Inner Join Documents D On
  D.UniqueID = ts1.UniqueID
  and [Status] = 9
  
  ORDER BY D.CreationTime desc
  </code></pre>
  
  <p>I'm still researching stuff online, but if anyone can point me in the right direction or give me some tips that would be awesome.</p>