'$times' GROUP BY user HAVI"/> '$times' GROUP BY user HAVI">

mysql随机获取优化话语

WBOY
Release: 2016-06-13 12:29:36
Original
719 people have browsed it

mysql随机获取优化语句
在网上找了一个随机取数语句,结合了自己的需求,运行出错,
看了半天没发现出错的地方,求指点

<br />
$str="select * from dizhi where shijiancuo>'$times' GROUP BY user HAVING COUNT(user) > 4 AS t1 <br />
JOIN (SELECT ROUND(RAND() * (SELECT MAX(id) FROM dizhi)) AS id) AS t2 <br />
WHERE t1.id >= t2.id <br />
ORDER BY t1.id ASC LIMIT 1" ;<br />
<br />
<br />
<br />
Copy after login
select * from
 (select * from dizhi where shijiancuo>'$times' GROUP BY user HAVING COUNT(user) > 4) AS t1 
 JOIN
 (SELECT ROUND(RAND() * (SELECT MAX(id) FROM dizhi)) AS id) AS t2 
 WHERE t1.id >= t2.id 
 ORDER BY t1.id ASC LIMIT 1

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!