title: Select random rows in mysql with whose column sum should meet condition value
body: <p>I need to have random questions from my question bank.I have a table <code>tbl_mq</code> with columns <code>mq_id</code>, course, unit, question, marks. I need to randomize such that the sum of the marks is 20.
  Here what i tried :</p>
  
  <pre><code>Select * 
  from tbl_mq 
  where sum(marks)=20 
  order by rand()
  </code></pre>
  
  <p>Example :</p>
  
  <pre><code>22, '3CA1151', 'I', 'Fisrt question', 5
  20, '3CA1151', 'I', 'Second question', 10
  15, '3CA1151', 'I', 'Thisrd question', 10
  24, '3CA1151', 'I', '4th question', 5
  13, '3CA1151', 'I', 'jyuyt', 10
  14, '3CA1151', 'I', 'fghfgh', 12
  </code></pre>
  
  <p>Result should be </p>
  
  <pre><code>22, '3CA1151', 'I', 'Fisrt question', 5
  20, '3CA1151', 'I', 'Second question', 10
  24, '3CA1151', 'I', '4th question', 5
  or 
  20, '3CA1151', 'I', 'Second question', 10
  15, '3CA1151', 'I', 'Thisrd question', 10
  </code></pre>
  
  <p>Finally i need questions such that the total marks of that columns is 20. Can any one help please?</p>