title: php/mysql: select query doesn't work properly
body: <p>sorry for not having a good title. because i dont really know the keyword to use,. 
  i have a table named document
  and i have a column name status and number</p>
  
  <p>i have data something like this
  3 sets of data
  1.</p>
  
  <pre><code>number -1 status-signed
  number -1 status-signed
  number -1 status-declined
  </code></pre>
  
  <p>i have a html table in my php website</p>
  
  <p>what i want is not show a data if one of its status is declined
  so basically number 1 will not appear on the html table  </p>
  
  <p>so how can i query that. i have something like this</p>
  
  <pre><code>select number, status from table document where status !="declined" and status = "signed" group by number
  </code></pre>
  
  <p>but that query don't work., it keeps showing the number with declined status in it. </p>
  
  <p>sorry for my bad english</p>
  
  <p>as stated by the answers below i tried this sql</p>
  
  <pre><code>select number
  from  document 
  group by number
  having sum(`status` &lt;&gt; 'declined') &gt; 0 and
     sum(`status` = 'signed') &gt; 0;
  </code></pre>
  
  <p>but the query above doesnt work because it keep showing the number 1. that must not be included. how can i fix this? thank you
  this is the data ony my table</p>
  
  <p><a href="https://i.stack.imgur.com/OZyLs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OZyLs.png" alt="enter image description here"></a></p>