Storing the results of a prepared statement as a table in mysql?

若如初见. 提交于 2019-12-05 14:23:46

Put the create table in the statement:

PREPARE STMT FROM "CREATE TABLE tab_derived_1 SELECT * FROM tab_1 WHERE predict_var = '4'   or predict_var = '2'  union 
(SELECT * FROM tab_1 WHERE predict_var = '0' or predict_var = '1' ORDER BY RAND() limit ?  )" ;
EXECUTE STMT USING @sample;

And if you want to return the results, not just store them in a table, just do a final

SELECT * FROM tab_derived_1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!