直接在sql语句中实现动态表名,可以通过"prepare"关键字实现
set @asql=concat(‘select * from uploadorder_’, DATE_FORMAT(now(), ‘%Y%m%d’),’ limit 10’);
prepare stml from @asql;
EXECUTE stml;
MySQL INSERT插入条件判断:如果不存在则插入
INSERT INTO table(field1, field2, fieldn) SELECT ‘field1’, ‘field2’, ‘fieldn’ FROM DUAL WHERE NOT EXISTS(SELECT field FROM table WHERE field = ?)