我自己用coalesce解决了这个问题
pseudocode:
if nametypes = OECD207
select row
elseif nametypes = OECD203
select row
elseif nametypes =OECD204
select row
end if
OECD207
OECD204
...
select
navn
, coalesce(OECD207, OECD203, OECD204, ...) as nametype
from
(
select
navn
, max(case when nametype = "OECD207" then nametype else null end) as OECD207
, max(case when nametype = "OECD203" then nametype else null end) as OECD203
, max(case when nametype = "OECD204" then nametype else null end) as OECD204
...
from ...
group by
navn
)