How to union tables into a new table in mysql?
I just loaded this into MySQL 5.5.37 on my Windows Laptop
use test
drop table if exists tbl1;
create table tbl1
(id int not null,
col1 int not null,
col2 int not null,
col3 int not null,
type int not null);
insert into tbl1 values
(1,  12,   12,   23,   1),
(2,  23,   33,   1,    0), 
(3,  333,  2,    21,   1);

Then, I tried out the query
mysql&gt; SELECT *
    -&gt; FROM tbl1
    -&gt; WHERE type=1 AND RAND() &lt;= 0.01
    -&gt; UNION
    -&gt; SELECT *
    -&gt; FROM tbl1
    -&gt; WHERE type =0 ;
+----+------+------+------+------+
| id | col1 | col2 | col3 | type |
+----+------+------+------+------+
|  2 |   23 |   33 |    1 |    0 |
+----+------+------+------+------+
1 row in set (0.00 sec)

mysql&gt;

Your syntax is just fine !!!
Your error message has UNION SELECT * SELECT * as the problem. Take a closer look at the message:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION
SELECT * 
SELECT * 
FROM tbl1
WHERE type =0
)' at line 3

I see SELECT * twice and a trailing right parenthesis that you did not type in the query.
If your version of MySQL consistently produces that error message, then you must have a bug within in the Query Parser. You may need to upgrade MySQL as a last resort.
SUGGESTION
Your CREATE TABLE will not have any indexes.
Try creating the table with indexes and loading afterwards
create table tbl2 like tbl1;
insert into tbl2
    SELECT * 
    FROM tbl1
    WHERE type=1 AND RAND() &lt;= 0.01
    UNION
    SELECT * 
    FROM tbl1
    WHERE type =0 
;