Answers for "mysql select top percent"

SQL
0

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)
);
Posted by: Guest on April-18-2021
0

MySQL top percent

SELECT price FROM prices p1 WHERE
(SELECT count(*) FROM prices p2 WHERE p2.price >= p1.price) <=
     (SELECT 0.1 * count(*) FROM prices)
);
Posted by: Guest on April-18-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language