Genereller Aufbau:
Insert into MyDest
select ... from MySource
where ...
group by ....
Das Problem ist nur noch die Bereichszusammenfassung:
case
when plz between 01050 and 01051 then '01050 01051'
when plz between 01052 and 01090 then '01052 01090'
when ....
else ...
end
Im Group by ist allerdings der Case-Ausdruck zu wiederholen.
Man kann auch folgendes gestalten:
insert into MyDest
with
xMyFile as (
select ...
case ... as Plz_Von_Bis
...
from Myfile
where
)
select .... from xMyFile
group by ..., Plz_Von_Bis, ...
Bookmarks