HugoMonteiro
HugoMonteiro

Reputation: 23

SQL Query using Random

Hi could anyone help me with something?

I need a mysql query that can return 4 values from a column in some table, also select all fiels from each row.

something like:

SELECT * FROM dadoslivros WHERE RAND() =1 limit 100;

But i only want the random form row ID.

Thanks.

Upvotes: 0

Views: 34

Answers (1)

Taryn
Taryn

Reputation: 247880

It seems like you just want to use ORDER BY RAND():

select *
from dadoslivros
order by rand()
limit 100

See SQL Fiddle with Demo

Upvotes: 1

Related Questions