title: MySql hierarchical query, how to get sequence from 1 to n
body: <p>Is there a way to get in MySQL query the same result as Oracle's</p>
  
  <pre><code> WITH t(n) AS 
  (
      SELECT 1
      FROM DUAL
      UNION ALL
      SELECT n+1 FROM t WHERE n &lt; 5
  )
  SELECT * FROM t;
   or
  select level
  from dual
  connect by level &lt; 100
  </code></pre>
  
  <p>?</p>
  
  <p>Here is my thoughts about this in MySQL SQL</p>
  
  <pre><code>select *
  from
    (select @level := ifnull(@level,1) +1  as prev
    )a
  where a.prev &lt; 100;
  </code></pre>
  
  <p>but sub-query don't executes dynamically</p>