title: COUNT() function and SELECT with DISTINCT on multiple columns
body: <p>Hoping someone can help me figure why I'm getting a syntax error here. I'm counting all rows that have two distinct column values.     </p>
  
  <pre><code>select count (*) as 'Distinct' from (
      select distinct p.IDD, p.num
      from PERF1 p
      inner join MAST1 m
      on (m.id_table = p.id_table and m.SOURCE_TABLE = p.SOURCE_TABLE)
      where m.DATE &gt; '2012-12-31' )
  </code></pre>
  
  <p>I'm getting an error on my last close bracket but can't for the life of me figure what I'm doing wrong here.
  ...............................</p>
  
  <p>Kind of a huge "edit" but I'm a bit stuck. I thought that this query would count the number of distinct rows (for both columns) across this table. So for instance the count should return 6 since "P" and "T" are repeated. I thought I had it with this:</p>
  
  <pre><code>select count (*) as 'Distinct' from (
  select distinct p.IDD, p.co
  from PERF1 p
  inner join MAST1 m
  on (m.id_table = p.id_table and m.SOURCE = p.SOURCE)
  where m.DATE &gt; '2012-12-31' ) TempTable
  </code></pre>
  
  <p>but I'm getting a much higher number than I think I should so I'm hoping that my query is incorrect.</p>
  
  <pre><code>+------+------+
  | IDD  | CO   |
  +------+------+
  | 11   | P    |
  | 12   | P    |
  | 13   | T    |
  | 14   | T    |
  | 15   | R    |
  | 16   | S    |
  | 17   | U    |
  | 18   | K    |
  </code></pre>