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