title: mysql select distinct(clientid) from table
body: <p>I have a problem that I can't figure out.
   First I did this</p>
  
  <pre><code>SELECT DISTINCT(ClientID) AS ID 
  FROM table 
  WHERE column4 IS NOT NULL AND TRIM(column4) &lt;&gt; '' 
  ORDER BY ClientID ASC
  </code></pre>
  
  <p>works great but my problem is now after I got the unique clientid`s from table.
  Trying to take out the other unique clientid's that do not have value in column3 or 4</p>
  
  <p>I did try this but is obviously wrong because I get in there the clientid that at 1 time had value in column3 and 4</p>
  
  <pre><code>SELECT DISTINCT(ClientID) AS ID 
  FROM table 
  WHERE ClientID != '(SELECT DISTINCT(ClientID) 
                        FROM table 
                        WHERE column4 IS NOT NULL AND TRIM(column4) &lt;&gt; '' )' 
  ORDER BY ClientID ASC
  </code></pre>
  
  <p>the table is like this</p>
  
  <pre><code>Table
     ClientID - can be 2..3...4 times in the table
     ID       - unique id
     column3 - can be empty
     column4 - can be empty
     column5 - can be empty
  </code></pre>