I have 3 tables and I have the following query:
select S.ID, C.IDSENSOR, C.ID, CF.IDCANAL, MAX(CF.ENTRY_ID) as entry, cf.estado
from Sensor as S
join Canal as C on S.Id = C.IdSensor
join CanalFeed as CF on C.Id = CF.IdCanal
where S.Id = 1
GROUP BY S.ID,C.IDSENSOR,C.ID,CF.IDCANAL, cf.estado
order by CF.IDCANAL
I get the following result:
How would you change that query so that it brings the largest (ENTRY_ID) for each channel id? Marco in red as I just want to bring the query.
Edition
How would you bring me only those marked in red because it would be for each channel id bring me the largest one by ENTRY