当前位置: 代码迷 >> MySQL >> mysql随机取数据,怎么实现高效率
  详细解决方案

mysql随机取数据,怎么实现高效率

热度:233   发布时间:2016-05-05 16:26:11.0
mysql随机取数据,如何实现高效率?
SELECT sh1.* FROM fw_share AS sh1 JOIN (SELECT 	ROUND(		RAND() * ((SELECT MAX(share_id) FROM fw_share)-(SELECT MIN(share_id) FROM fw_share)) 		+ (SELECT MIN(share_id) FROM fw_share)	) AS share_id) AS sh2 WHERE sh1.share_id>=sh2.share_id

?

http://my.oschina.net/sharephper/blog/100104

  相关解决方案