Without the sub select I can use this query to get my result of group op ID with a Max eff date:
[COLOR=green yellow]
select b.group_id, MAX(a.eff_dte)
from
iw_table1 a
,iw_table2 b
where
a.client_id = b.group_client_id
and b.carrier_id = ('2368')
Group by 1
[/color]
However I need to see this product code but maintain the max eff date per group. There are multiple product codes for each group with different dates. I tried using this query but it's given me spool issues. Can you please help tweak?
[COLOR=green yellow]
select b.group_id, a.retro_product_type_cde, a.eff_dte
from
iw_table1 a
,iw_table2 b,
(select d.group_id, MAX(c.eff_dte)
from
iw_table1 c,iw_table2 d
group by 1)maxresults
where
a.client_id = b.group_client_id
and b.carrier_id = ('2368')
and a.eff_dte = maxresults.Maxdate
Group by 1,2,3
[/color]
[COLOR=green yellow]
select b.group_id, MAX(a.eff_dte)
from
iw_table1 a
,iw_table2 b
where
a.client_id = b.group_client_id
and b.carrier_id = ('2368')
Group by 1
[/color]
However I need to see this product code but maintain the max eff date per group. There are multiple product codes for each group with different dates. I tried using this query but it's given me spool issues. Can you please help tweak?
[COLOR=green yellow]
select b.group_id, a.retro_product_type_cde, a.eff_dte
from
iw_table1 a
,iw_table2 b,
(select d.group_id, MAX(c.eff_dte)
from
iw_table1 c,iw_table2 d
group by 1)maxresults
where
a.client_id = b.group_client_id
and b.carrier_id = ('2368')
and a.eff_dte = maxresults.Maxdate
Group by 1,2,3
[/color]