〖Orz〗求一条sql语句

WBOY
Release: 2016-06-13 13:24:20
Original
973 people have browsed it

〖Orz〗求1条sql语句
想优先 Rand() 出来 'phome_ecms_news' 表的 classid limit 1 (并且符合) isLast(终极栏目) = 1

然后再在 表 'phome_enewsClass' 里面进行 RAND() limit 1


下面sql语句错误..不会写的情况下,只有表述一下思想了.

SQL code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->SELECT * FROM 'phome_ecms_news' WHERE classid = (SELECT classid FROM 'phome_enewsClass' where islast=1 RAND() limit 1) RAND() limit 1;
Copy after login


------解决方案--------------------
SQL code
SELECT * FROM 'phome_ecms_news' WHERE classid IN  
  (
  SELECT classid FROM 'phome_enewsClass' where islast=1 ORDER BY RAND() limit 1
  )
  ORDER BY RAND() limit 1; <div class="clear">
                 
              
              
        
            </div>
Copy after login
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!