For MySQL, how to INSERT the result of a SELECT statement?
The basic syntax for this generally involves inserting into one table by selecting from another, which would look something like:

INSERT INTO t1 (a1, b1)
     SELECT a2, b2 
       FROM t2
      WHERE a2 &gt; 0
            AND
            b2 &gt; 0
;


There is some flexibility in that, although perhaps not as much as you are looking for. It might be worth looking at the mysql docs for insert-select for more information.