Home Backend Development PHP Tutorial 〖Orz〗求一条sql语句

〖Orz〗求一条sql语句

Jun 13, 2016 pm 01:24 PM
limit rand select

〖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
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve 'undefined: rand.Seed' error in golang? How to solve 'undefined: rand.Seed' error in golang? Jun 25, 2023 am 08:34 AM

During the development or learning process of using Golang, we may encounter the error message of undefined:rand.Seed. This error usually occurs when you need to use a random number generator, because in Golang you need to set a random number seed before you can use the function in the rand package. This article will explain how to resolve this error. 1. Introduce the math/rand package. First, we need to introduce the math/rand package into the code. exist

Detailed explanation of how to use take and limit in Laravel Detailed explanation of how to use take and limit in Laravel Mar 10, 2024 pm 05:51 PM

"Detailed explanation of how to use take and limit in Laravel" In Laravel, take and limit are two commonly used methods, used to limit the number of records returned in database queries. Although their functions are similar, there are some subtle differences in specific usage scenarios. This article will analyze the usage of these two methods in detail and provide specific code examples. 1. Take method In Laravel, the take method is used to limit the number of records returned, usually combined with the orderBy method.

Asynchronous processing method of Select Channels Go concurrent programming using golang Asynchronous processing method of Select Channels Go concurrent programming using golang Sep 28, 2023 pm 05:27 PM

Asynchronous processing method of SelectChannelsGo concurrent programming using golang Introduction: Concurrent programming is an important area in modern software development, which can effectively improve the performance and responsiveness of applications. In the Go language, concurrent programming can be implemented simply and efficiently using Channels and Select statements. This article will introduce how to use golang for asynchronous processing methods of SelectChannelsGo concurrent programming, and provide specific

How to hide the select element in jquery How to hide the select element in jquery Aug 15, 2023 pm 01:56 PM

How to hide the select element in jquery: 1. hide() method, introduce the jQuery library into the HTML page, you can use different selectors to hide the select element, the ID selector replaces the selectId with the ID of the select element you actually use; 2. css() method, use the ID selector to select the select element that needs to be hidden, use the css() method to set the display attribute to none, and replace selectId with the ID of the select element.

How to implement change event binding of select elements in jQuery How to implement change event binding of select elements in jQuery Feb 23, 2024 pm 01:12 PM

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

How to synchronize random number generation in Golang parallel processing? How to synchronize random number generation in Golang parallel processing? Jun 03, 2024 pm 02:53 PM

Synchronizing random number generation in Go concurrent programming: Use a mutex (sync.Mutex) to control access to the rand.Rand random number generator. Each goroutine acquires the mutex lock before generating random numbers and releases the mutex lock after generating it. This ensures that only one goroutine can access the random number generator at a time, eliminating data races.

What is the reason why Linux uses select? What is the reason why Linux uses select? May 19, 2023 pm 03:07 PM

Because select allows developers to wait for multiple file buffers at the same time, it can reduce IO waiting time and improve the IO efficiency of the process. The select() function is an IO multiplexing function that allows the program to monitor multiple file descriptors and wait for one or more of the monitored file descriptors to become "ready"; the so-called "ready" state is Refers to: the file descriptor is no longer blocked and can be used for certain types of IO operations, including readable, writable, and exceptions. select is a computer function located in the header file #include. This function is used to monitor file descriptor changes—reading, writing, or exceptions. 1. Introduction to the select function. The select function is an IO multiplexing function.

How to solve the problem of generating the same random numbers using php rand function How to solve the problem of generating the same random numbers using php rand function Mar 23, 2023 am 09:17 AM

The rand() function uses the same initial seeds on each call. The default initial seed is obtained from the operating system's time, but it only has microsecond accuracy. That is, within a very short period of time, many rand() function calls will use the same initial seed, resulting in the same random number generation. So, how to solve this problem?

See all articles