Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql random

SELECT name
  FROM random AS r1 JOIN
       (SELECT CEIL(RAND() *
                     (SELECT MAX(id)
                        FROM random)) AS id)
        AS r2
 WHERE r1.id >= r2.id
 ORDER BY r1.id ASC
 LIMIT 1
Comment

rand mysql

1
2
3
4
5
SELECT f.id FROM files f
      JOIN ( SELECT RAND() * (SELECT MAX(id) FROM files) AS max_id ) AS m
      WHERE f.id >= m.max_id
      ORDER BY f.id ASC
      LIMIT 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: create table with timestamp postgresql 
Sql :: mysql_num_fields in mysqli 
Sql :: mysql create user with grant privileges 
Sql :: SQL COUNT() with WHERE 
Sql :: sql select where clause 
Sql :: 2nd max salary query in sql 
Sql :: oracle simple quote 
Sql :: sql trim from string 
Sql :: sql server create database 
Sql :: where condition in mongodb 
Sql :: mysql community server 
Sql :: mysql with 
Sql :: select last n rows mysql 
Sql :: for select oracle 
Sql :: SQLITE_BUSY: database is locked 
Sql :: distinct in sql server 
Sql :: ERROR 1064 (42000) 
Sql :: sub query postgres 
Sql :: restart mysql 
Sql :: how to get specific salary in sql 
Sql :: from . import _mysql ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory linux 
Sql :: sql order by with where 
Sql :: how covert into int in maria db 
Sql :: sql roll up rows into columns 
Sql :: copy column from one table to another without column duplicate postgres 
Sql :: sqrt(i) 
Sql :: close external port 3306 with iptables 
Sql :: sql default constraint 
Sql :: postgresql powershell query 
Sql :: sql exemplos 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =