title: Update column in database where max value php mysql
body: <p>I got problem here. im updating name where B has the biggest value.</p>
  
  <p>so the results are</p>
  
  <pre><code>B  | name
  ---|------
   1 | 
   2 | 
   3 | YES
  </code></pre>
  
  <p>but when column B changes value the problem is column name with row value 3 still has a value.</p>
  
  <pre><code>B  | name
  ---|------
   1 | 
   4 | YES
   3 | YES  
  </code></pre>
  
  <p>the results should be.</p>
  
  <pre><code>B  | name
  ---|------
   1 | 
   4 | YES
   3 |   
  </code></pre>
  
  <p>if </p>
  
  <pre><code>B  | name
  ---|------
   0 | 
   0 | 
   0 |  
  </code></pre>
  
  <p>then</p>
  
  <pre><code>B  | name
  ---|------
   0 | 
   0 | 
   0 |  
  </code></pre>
  
  <p>if,</p>
  
  <pre><code>B  | name
  ---|------
   4 | 
   4 | 
   2 | 
  </code></pre>
  
  <p>then</p>
  
  <pre><code>B  | name
  ---|------
   4 | YES
   4 | YES
   2 |   
  </code></pre>
  
  <p>this is what i want.</p>
  
  <p>im only using this simple code.</p>
  
  <pre><code>$sql3 = "UPDATE products SET name='YES' ORDER BY B DESC";
  </code></pre>