title: Trying to use limit with variable in MySQL
body: <p>I am trying this code to use LIMIT in MYSQL with a variable. When I use a simple number for LIMIT it works fine but when I use a variable then it's not working.</p>
  
  <pre><code>SET @increment:=9;
  SET @number:=1;
  SET @end:=10*@number;
  SET @start:=@end-@increment;
  
  SELECT name, detail FROM tab1 LIMIT @start, @end;
  </code></pre>
  
  <p>When I use the below code (no variable) it works fine:</p>
  
  <pre><code>SELECT name, detail FROM tab1 LIMIT 0,10;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wmB5n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wmB5n.jpg" alt="enter image description here"></a></p>