title: Different Criteria in WHERE CLAUSE in MYSQL
body: <p>I have five Parameters to check in MYSQL query.Here are these</p>
  
  <pre><code>1- price
  2-Category
  3-location
  4-sublocation
  5-beds
  </code></pre>
  
  <p>Now first two are must like this </p>
  
  <pre><code>SELECT * FROM TABLE1 WHERE price&gt;myprice1 AND price&lt;myprice2 AND category=mycategory
  </code></pre>
  
  <p>For rest of three i have different case.here is general case</p>
  
  <pre><code>SELECT * FROM TABLE1 WHERE price&gt;myprice1 AND price&lt;myprice2 AND category=mycategory
  AND location=mylocation AND sublocation=mysublocation AND beds=mybeds
  </code></pre>
  
  <p>IF this query do not give me result then i can remove beds like this</p>
  
  <pre><code>SELECT * FROM TABLE1 WHERE price&gt;myprice1 AND price&lt;myprice2 AND category=mycategory
  AND location=mylocation AND sublocation=mysublocation
  </code></pre>
  
  <p>I need atleast 10 result...if this query give me 5 results then i will remove sublocation but in result those five results must be on top.</p>
  
  <p>Generally,to get my result i have to reduce ANDs but matching with previous/removed parameters result must be on top.</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>This is my query</p>
  
  <pre><code>SELECT * FROM TABLE1 WHERE price&gt;140000 AND price&lt; 210000 AND category=1 AND location=2
  </code></pre>
  
  <p>I have this query now which give me 5 results so i want to remove last AND which will give me more result</p>
  
  <pre><code>SELECT * FROM TABLE1 WHERE price&gt;140000 AND price&lt; 210000 AND category=1
  </code></pre>
  
  <p>but now i want to show all those 5 records having location=2 on top</p>