ungefär so?
Code:
with a as (select item, max(dat) as dat
from VKfile
group by item),
b as (select item, dat, price
from a, VKfile
where a.item=VKfile.item and a.dat=VKfile.dat),
c as (select item, max(dat) as dat
from EKfile
group by item),
d as (select item, dat, price
from a, EKfile
where a.item=EKfile.item and a.dat=EKfile.dat)
select item, b.price als VKP, d.price as EKP
from b, d
where b.item = d.item
Wenn ich Sie richtig verstanden habe.
in B und D steht je Item der letzte Wert. Nur wenn Preise im voraus erfasst werden sind noch Anpassungen nötig.
DiBe
Bookmarks