Can someone show me the MySQL equivalent of the following statement (which works in Oracle 10g)?
INSERT INTO VOUCHER (VOUCHER_NUMBER, BOOK_ID, DENOMINATION)
SELECT a.a1, b.ID, b.DENOMINATION FROM
(SELECT rownum a1 FROM dual CONNECT BY rownum <= 10000000) a, BOOK b
where a.a1 between b.START_NUMBER and b.START_NUMBER+b.UNITS-1;
Basically, what this is doing is for every entry in the table BOOK, it is making entries in the table VOUCHER. The number of entries in the VOUCHER table is determined by the number of UNITS in the corresponding row in the BOOK table. I can provide more information if this is unclear.