Untitled
unknown
plain_text
2 years ago
1.3 kB
2
Indexable
select max(mat.de_insumo) as de_insumo, mat.cd_upnivel1, max(mat.dt_historico) as dt_aplicacao, mat.cd_safra, u.id_bloco_colheita from oti_maturador mat left join ( select distinct u1.cd_upnivel1 ,u1.de_upnivel1 ,u3.id_safra_periodo ,u2.cd_upnivel2 ,u3.cd_upnivel3 ,s.cd_safra ,u3.id_bloco_colheita from oti_upnivel1 u1, oti_upnivel2 u2, oti_upnivel3 u3 ,oti_safras_periodo s where u1.id_upnivel1 = u2.id_upnivel1 and u2.id_upnivel2 = u3.id_upnivel2 and u3.id_safra_periodo = s.id_safra_periodo ) u on (u.cd_upnivel1 = mat.cd_upnivel1 and u.cd_upnivel2 = mat.cd_upnivel2 and u.cd_upnivel3 = mat.cd_upnivel3) group by mat.cd_upnivel1, mat.cd_safra, u.id_bloco_colheita;
Editor is loading...