It works?
SELECT p1, p2, p3 FROM temp_table WHERE p4 in (1, 2);
This is a much simpler way to write the same query.
EDIT:
If with "fail" you mean "doesn't return any rows," then you have a simple problem. CREATE TABLE LIKE does not populate the table. It creates a table with the same structure as any_other_table , but without rows. Then you should fill it with insert . Or use create table only with select statement.
source share