

select MAX(CAST("Oid" AS CHAR(100))) As "Oid", 
       "BankPrepareName"
from "RegistryBankTransfer"
where Rtrim(Ltrim(coalesce("BankPrepareName",'')))<>''
group by "BankPrepareName"

