I have tried using the columns alias, column number, using the case statement in the group by with no luck. Is this a shortcoming of interbase?
select
case
when vp.preferredvendor = 'Y' then vp.name
else 'Misc'
end as vendor,
sum(sa.totalfare)
from
SalesActivity(1,1,2, '2014-01-01', '2014-02-01') sa
join
booking bk on bk.bookingno = sa.bookingno
join
profile vp on bk.vendor_linkno = vp.profileno
group by
vendor
Repeat the
case:As a side note, some databases do allow the use of column aliases in the
group byclause, but definitely not all of them and it is definitely not required by the standard.