Subject RE: [firebird-support] max count question
Author Svein Erling Tysvær
>Hi Norman.
>
>that's exactly what I'm looking for:
>
>with whatever as
>(select field_name,count(*) as kount
>from table_name
>group by field_name)
>select field_name from whatever
>where kount = (select min(kount) from whatever);

If you only want one row returned, this can be slightly simplified (or at least, I think it is simpler):

with whatever as
(select field_name, count(*) as kount
from table_name
group by field_name)

select field_name from whatever
order by kount
rows 1

HTH,
Set