This is in Oracle database. Say I have the following table A:
column1 column2
id1 a
id2 a
id3 a
id4 b
id5 b
id6 c
So what I want the sql does is: First count there's three As and two bs and one c, then based on the counts return me the smallest number of these counts, in this case is 1 (because we only have one c)
Can this be achieved somehow by using the combination of MIN and COUNT?
In Oracle you can do this directly; count per group and use MIN on the results to get back one row with the desired value.
select min(count(*))
from tablea
group by column1;
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