title: Count on DISTINCT of several fields work only on MySQL?
body: <p>I need a Query that without any changes work on these three different database server : MySQL, MSSQL, PostgreSQL .
  In this query i have to to calculate a column with the following expression that work correctly on MySQL : </p>
  
  <pre><code>COUNT(DISTINCT field_char,field_int,field_date) AS costumernum
  </code></pre>
  
  <p>The fields in the distinct are of different type : </p>
  
  <pre><code>field_char = character
  field_int  = integer
  field_date = datetime
  </code></pre>
  
  <p>The expression is inside a parent query select, so if i try to achieve the result with a sub query approach, i stumble in this situation : </p>
  
  <pre><code>SELECT t0.description,t0.depnum
  (select count(*) from (
    select distinct f1, f2, f3 from salestable t1
    where t1.depnum = t0.depnum
  ) a) AS numitems
  FROM salestable t0
  </code></pre>
  
  <p>I get an error with this query, how can i get the value of the parent query ? </p>
  
  <p>The expression work correctly on MySQL but i get an error when i try to execute it on Sql Server or PostgreSQL (the problem is that the count function doesn't accept 3 arguments of different type on MSSQL/PostgreSQL), is there a way to achieve the same result with an expression that work in each of these database server (SQL Server, MySQL, PostgreSQL ) ?</p>