Hi,
I generally understand logic behing the transformation , but
got some strange query and seems like I'm lost in translation,
please clarify for me
select * from
(
select a.UMOWA ,a.NR_KARTY, a.LOGO, a.DATA_ZAL, a.WYCIAG,
b.pesel, b.imie, b.nazwisko,
c.kod, c.miasto, c.ulica, c.nr_dom, c.nr_mieszk, c.data_rej,
rank() over (partition by d.umowa, d.nr_karty order by sta_id desc, priorytet asc, c.data_rej desc) pozycja
from doris_100 a, tab b, tab_adr c , karty d
where a.nr_karty = d.nr_karty(+)
and a.umowa=d.umowa(+)
and d.id_kontr = b.id_kontr
and b.id_kontr = c.tk_id_kontr
and b.ok = 1
and wazny = 1
and sta_id in (1,3)
) a
where pozycja = 1;
how to rewrite that with no subquery with keep dense_rank equivalent
My understanding is I should group by partitioned column ( d.umowa, d.nr_karty) but what about others ?
There should be max from sta_id (but no in output) so I can skip but what with a.UMOWA ,a.NR_KARTY columns ?
Should those be max/min with keep dense_rank ?
I'm on 10.2.0.3 EE .
Regards.
Greg
Edited by: GregG on Oct 11, 2010 10:03 AM
Edited by: GregG on Oct 11, 2010 10:04 AM