我正试图制作充满活力的表格。 我正在从这部法典中看到错误,这是一部动态的飞跃。 我不知道这个问题是什么。 我是动态和储存程序的新鲜事。
PREPARE stmt FROM "CREATE TABLE `?` SELECT lat, lon, nfldtime FROM position_reports where mmsi = ? ORDER BY id DESC LIMIT 100";
EXECUTE stmt USING CONCAT("mmis", FORMAT(vesselID,0)), vesselID;
我在努力制定程序时,先是:
Script line: 4 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 CONCAT("mmis", FORMAT(vesselID,0)), vesselID;
I tried this:
EDIT:
从@Konerak的答复来看,现在的工作是:
set @s = CONCAT("CREATE TABLE mmsi", vesselID, " SELECT lat, lon, nfldtime FROM position_reports where mmsi = ", vesselID, " ORDER BY id DESC LIMIT 100");
prepare createTable from @s;
EXECUTE createTable;
DEALLOCATE PREPARE createTable;