I have a select
select distinct
min(trunc(ALL_SUBS_DAY.CHARGE_AMT * SUP.SHARE_USAGE, 4)) + (ALL_SUBS_DAY.CHARGE_AMT - sum(trunc(ALL_SUBS_DAY.CHARGE_AMT * SUP.SHARE_USAGE, 4))) as CHARGE_AMT
from table names;
when I try to run it I get not a single-group group function. If I do it like this
select
min(trunc(ALL_SUBS_DAY.CHARGE_AMT * SUP.SHARE_USAGE, 4)) + (ALL_SUBS_DAY.CHARGE_AMT - sum(trunc(ALL_SUBS_DAY.CHARGE_AMT * SUP.SHARE_USAGE, 4))) as CHARGE_AMT
from table names
group by SUBS_DAY.CHARGE_AMT, SUP.SHARE_USAGE;
it works. Wasn't distinct supposed to work like group by? Do I really need to list every single column or is there a way not to do it?