title: If statement within a where clause utilizing varible to create variables
body: <p>I am looking for a way to compare information from a MYSQL database in PHP utilizing the </p>
  
  <p>following logic:</p>
  
  <pre><code>IF 1a+2a=200, then ma=100
  
  ElseIf 1a+2a=101, then ma=1
  
  Elseif 1a+2a=2, then ma=1
  
  else ma=0
  
  IF 1b+2b=200, then mb=100
  
  ElseIf 1b+2b=101, then mb=1
  
  Elseif 1b+2b=2, then mb=1
  
  else mb=0
  </code></pre>
  
  <p>then taking <code>ma+mb &gt; 100</code> to make it a match</p>
  
  <p>i am looking to use this info in the where clause of the select statement.</p>
  
  <p>i have a user that needs to use this info against other users in the db to determine a match.  essentially each user has a column name, a, that either has 100, 1 or 0.  we add the current user data with all queried user info from the database to determine a match.</p>
  
  <p>I amusing MYSQL and php, and i have tried a number of scenarios and just can't sem to get it working, any help or best advice is welcome and thanks in advance.</p>
  
  <p>the update table looks like this</p>
  
  <p>user1 </p>
  
  <pre><code>   A    b   c  d
     100  1   0  1
  </code></pre>
  
  <p>user2 </p>
  
  <pre><code>   A    b   c  d
     100  1   1  1
  </code></pre>
  
  <p>i need to compare users to see if they match based on the above criteria which is if like columns are added up and eventually reach 101 or greater they are a match.  there are 34 columns in all.  User 1 would be the constant user, there could be more users other than user2, there will be user3,4 5 etc.</p>