0
I need to select only row 1 of the table, I’ve used the DISTINCT
and it didn’t work
follows the Query:
select
Max(remessa.dt_uso_inicio) as DATA_REMESSA
,min(dt_entorc_oficina)DATA_ABERTURA
,patr.nr_patrimonio AS PATRIMONIO
from
orcos as o
join
patrimon as patr
on o.cd_PATRIMONIO= patr.cd_PATRIMONIO
join
v_remessa_patrimonio as remessa
on remessa.cd_patrimonio = patr.cd_patrimonio
where patr.nr_patrimonio = '070-13 GEA'
group by
patr.nr_patrimonio
,o.dt_entorc_oficina
having o.dt_entorc_oficina > max(remessa.dt_uso_inicio)
;
Continuation topic: Select the line with the oldest date within this query between the repeated values
The SELECT TOP clause is used to specify the number of records to be returned. SQL Server / MS Access Syntax: SELECT TOP number|Percent .....
– user60252