Storing the results of a prepared statement as a table in mysql?
Is it possible to store the result of a prepared table in mysql ? My use case is - : I am creating two variables based on certain conditions of the source table, then fetching the randomized rows, based on this criteria. Since I have 10 of such tables, should I be 1st joining them and then doing this randomization on the "overall" passing/filtering criteria (See also @total below, which is my main criteria, PER table) set @total=(select count(*) from tab_1 where predict_var ="4" or predict_var ="2" ) ; set @sample= ( select @total*(70/30)) ; PREPARE STMT FROM " SELECT * FROM tab_1 WHERE