mysql dynamic SQL Pragmatic

set @ tbnm = “user”;

set @ p1 = “nickname”;

set @ p2 = “asd”;

set @ frist_sql = concat (“select”, @ p1, “from”, @ tbnm, “where nickname = ‘”, @ p2, “‘”);

prepare stmt from @ frist_sql;

EXECUTE stmt;