title: Select distinct returns duplicates
body: <p>I have the following query:</p>
  <pre><code>SELECT 
  DISTINCT (TK.TICKETID),
  TK.DESCRIPTION,
  TK.CREATIONDATE,
  TK.REPORTEDBY,
  TK.OWNER,
  WF.ASSIGNCODE
  FROM ticket TK
  INNER JOIN wfassignment WF on WF.OWNERID = TK.TICKETUID
  WHERE TK.status not in ('ЧЕРНОВИК', 'ЗАКРЫТ', 'ВЫПОЛНЕН') AND WF.ASSIGNSTATUS not in ('COMPLETE', 'INACTIVE')
  ORDER BY TK.TICKETID;
  </code></pre>
  <p>But it returns duplicates in TK.TICKETID attribute. And if i remove other attributes all ok.
  e.g.</p>
  <pre><code>TK.TICKETID TK.DESCRIPTION TK.CREATIONDATE  TK.REPORTEDBY  TK.OWNER     WF.ASSIGNCODE
  О1013249    Право доступа   02.06.14        CHERNOVDK      SKACHKOVSV   NOVIKOVVA
  О1013249    Право доступа   02.06.14        CHERNOVDK      SKACHKOVSV   PRITULADV
  О1013249    Право доступа   02.06.14        CHERNOVDK      SKACHKOVSV   SVESHNIKOVAV
  </code></pre>
  <p>How can I return only a single record per <code>TK.TICKETID</code>?</p>