1
How can I present the smallest factor by ID_ACORDO?
SELECT LIGACOES.ID
,ACORDO.ID_ACORDO
,ACORDO.DATA as 'DATA_ACORDO'
,LIGACOES.time_of_contact AS 'DATA_LIGACAO'
,ACORDO.data-LIGACOES.time_of_contact as FATOR
FROM SISCOB_acordo_itau_pf_varejo AS ACORDO
INNER JOIN
DWH_Developer.ASPECT_CONTACT_EVENTS AS LIGACOES ON (LIGACOES.account_number = ACORDO.id_contr)
where ACORDO.DATA>= LIGACOES.time_of_contact
You want to take the record that has the smallest value in the field ID_ACORDO, would it be this?
– Giancarlo Abel Giulian
No, actually I would like the records that contain the smallest factor per agreement.
– caezar