I want to use the second column (art_count) to show only those rows containing X percent of total art_count.
My data:
title art_count
a 3
b 12
c 9
d 4
e 45
My query so far:
SELECT title, COUNT(art) AS art_count
FROM table1
GROUP BY art HAVING ... ?
Tried it with SUM without success.
SELECT title, COUNT(art) AS art_count
FROM table1
GROUP BY art
HAVING art_count >= (select count(*) * X / 100 from table1)
You need to insert a value for X
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With