mysql中随机取出几条数据

 SELECT t1.id,title,extName,cover,url
FROM shop_articles AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM shop_articles)-(SELECT MIN(id) FROM shop_articles))+(SELECT MIN(id) FROM shop_articles)) AS id) AS t2
WHERE t1.id >= t2.id and type=_type
ORDER BY t1.id LIMIT _num;
上一篇:Redis与Java - 数据结构


下一篇:jQuery 实现bootstrapValidator下的全局验证