MySQL通过选择替代创建表?

时间:2013-12-14 06:18:27

标签: mysql create-table

我正在尝试创建MySQL查询,例如而不是

CREATE TABLE query_table ENGINE=MYISAM
SELECT 
DISTINCT
g.gameid,
g.image, 
g.title,
FROM scores AS s
INNER JOIN games AS g
ON(s.gameid = g.gameid)
INNER JOIN user AS u
ON(s.userid = u.user_id)
ORDER BY s.time DESC 
LIMIT 20;

有类似截断和插入选择的内容

TRUNCATE TABLE query_table ENGINE=MYISAM
INSERT 
SELECT DISTINCT
g.gameid,
g.image, 
g.title,
FROM scores AS s
INNER JOIN games AS g
ON(s.gameid = g.gameid)
INNER JOIN user AS u
ON(s.userid = u.user_id)
ORDER BY s.time DESC 
LIMIT 20;

加快速度?因为我正在尝试创建临时表以将其保存为缓存大约5分钟并再次重新创建它。

0 个答案:

没有答案