Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

MySQL top percent

SELECT * FROM prices WHERE price >= (SELECT price FROM prices p1 WHERE
(SELECT count(*) FROM prices p2 WHERE p2.price >= p1.price) <=
     (SELECT 0.1 * count(*) FROM prices)
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #MySQL #top #percent
ADD COMMENT
Topic
Name
5+9 =