All pastes #469384 Raw Edit

Something

public sql v1 · immutable
·published 2007-05-03 18:43 UTC
rendered paste body
SELECT MAIN1.diaMax as ELDIAMAXIMO, MAIN1.notes as LANOTAMAXIMA FROM 	(	select h.hst_date as diaMax,  h.hst_note as notes from history as h 	WHERE h.hst_byr_usr_code='ascom' AND h.hst_ngt_code ='2'	UNION	select e.eml_date as diaMax, e.eml_subject as notes from email as e WHERE e.eml_ngt_code='2'	) as MAIN1	WHERE diaMax=(			select MAX(SUBMAIN.diaMax2) FROM 					(					select h.hst_date as diaMax2 from history as h 					WHERE h.hst_byr_usr_code='ascom' AND h.hst_ngt_code ='2'					UNION					select e.eml_date as diaMax2 from email as e WHERE e.eml_ngt_code='2'					) as SUBMAIN				)