mysql - SQL: how to select randomly and order by higest -


i have schema this:

create table users      (      id int auto_increment primary key,       name varchar(20),       point int(255)     );  insert users (name, point) values ('jack', 1), ('rick', 5), ('danny', 11), ('anthony', 24), ('barla', 3), ('james', 15), ('melvin', 12), ('orthon', 5), ('kenny', 2), ('smith', 30), ('steven', 27), ('darly', 45), ('peter', 44), ('parker', 66), ('lola', 78), ('jennifer', 94), ('smart', 87), ('jin', 64), ('david', 31), ('jill', 78), ('ken', 48), ('martin', 19), ('adrian', 20), ('oliver', 16), ('ben', 100); 

and sql is:

select id, name, point users order point desc, rand() limit 5 

problem is, query not select 5 row randomly , order them point. idea, how solve it? here sqlfiddle: http://sqlfiddle.com/#!2/18f15/1

select id,name,point (select id, name, point users order rand()   limit 5) abc order point desc; 

sqlfiddle


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -