title: how to set the value of LIMIT using select count(id) from another table |MySQL
body: <p>I have a scenario where the result must be limited depends on counting ids in another table.</p>
  
  <p>Suppose i have these two tables <code>counter</code> and <code>dispanser</code>,</p>
  
  <p>i want to <code>select</code> the last records in the table <code>counter</code> and limit the selection by counting the number of records in <code>dispanser</code> table.</p>
  
  <p>something like this</p>
  
  <pre><code>select * from counter limit (select count(dispID) from dispanser) 
  </code></pre>