santos_s 12 Denunciar post Postado Junho 20, 2015 SELECT cr.cod_cad_reser_semarh, cr.nome_cad_reser_semarh, cr.cap_cad_reser_semarh, cr.profun_cad_reser_semarh, cr.local_cad_reser_semarh, cr.lat_cad_reser_semarh, cr.lon_cad_reser_semarh, cr.usuarios_cod_usr, cr.tipo_cad_reser_semarh, cr.mun_cad_reser_semarh, cr.sit_cad_reser_semar, sea.cod_semar_acomp_reser, sea.nome_acomp_reserv, sea.vol_atual_acomp_reser, sea.dt_acomp_reserv, sea.dt_cad_acomp_reserv, usr.nome_usr, m.nome_municipio,ac.cod_acao,ac.nome_acao AS tipo_reservatorio FROM cad_reser_semarh AS cr INNER JOIN usuarios AS usr ON ( cr.usuarios_cod_usr = usr.cod_usr ) INNER JOIN semar_acomp_reser AS sea ON ( cr.usuarios_cod_usr = sea.usuarios_cod_usr ) INNER JOIN acoes AS ac ON(cr.tipo_cad_reser_semarh=ac.cod_acao) INNER JOIN municipio_ibge AS m ON ( cr.mun_cad_reser_semarh = m.cod_municipio ) WHERE cr.cod_cad_reser_semarh LIKE '$pesq_nome_reserv' AND dt_acomp_reserv = ( SELECT MAX( dt_acomp_reserv ) FROM semar_acomp_reser s2 WHERE s2.nome_acomp_reserv = sea.nome_acomp_reserv ) AND sea.nome_acomp_reserv LIKE '$pesq_nome_reserv' Resolvido. Compartilhar este post Link para o post Compartilhar em outros sites