title: UNION type mismatch
body: <p>When I run below query I am getting this error</p>
  
  <blockquote>
    <p>UNION types text and bigint cannot be matched</p>
  </blockquote>
  
  <pre><code>SELECT 
      1 AS STEP
    , '' AS ProviderName
    , '' AS Procedurecode
    , Claimid
    , Patient_First_Name
    , Patient_Last_Name
    , DOS
    , SUM(COALESCE(Total_Charge,0))
    , SUM(COALESCE(PaidAmount,0))
    , PostedDate
    , CheckEFTDate
    , CheckEFTNo 
  FROM table_name
  GROUP BY ProviderName, Claimid, Patient_First_Name, Patient_Last_Name, DOS, PostedDate,
           CheckEFTDate, CheckEFTNo
  UNION ALL
  SELECT 
      2 AS STEP
    , '' AS ProviderName
    , '' AS Procedurecode
    , COUNT(Claimid)
    , '' AS Patient_First_Name
    , '' AS Patient_Last_Name
    , NULL::date AS DOS
    , SUM(COALESCE(Total_Charge,0))
    , SUM(COALESCE(PaidAmount,0))
    , NULL::date AS PostedDate
    , NULL::date AS CheckEFTDate
    , '' AS CheckEFTNo 
  FROM table_name
  GROUP BY Claimid
  </code></pre>