Subject Select works, view fails
Author mikcaau
I can run this select
/* this will later be a view */
select Ap.Id, Ap.AgencyId,
Ag.FullName, Ag.Abbreviation,
Pro.FullName, Pro.Abbrev, Pro.ProgStart, Pro.ProgEnd,
Fb.FullName, Fb.Abbrev
from AgenciesPrograms Ap
left join Agencies Ag on Ag.AgencyId = Ap.AgencyId
left join Programs Pro on Pro.ProgId = Ap.ProgId
left join FundingBodies Fb on Fb.FbId = Pro.FbId
;

but when I attempt to convert it to view by prefixing
create View AViewName
as

then select statement

I receive this error message

/*ISC ERROR CODE:335544351

ISC ERROR MESSAGE:
unsuccessful metadata update
STORE RDB$RELATION_FIELDS failed
attempt to store duplicate value (visible to active transactions) in
unique index "RDB$INDEX_15"*/

What did I do wrong?
Did backup restore with no problems.
Mick