I have a question of a complex query and I don\'t know how to write it. I have the next table:
+---------------+-----------+----------+--------------------------
Try this query :-
select * from (
select * from (
SELECT a.id,
nia.idaction grp_is,
MAX(CONCAT(nia.fecha, ' ', nia.hora)) time_is
FROM nectar_incidencias_alarma nia
INNER JOIN alarmas a
ON a.id=nia.id_alarma
WHERE nia.idaction IN (6,7)
GROUP BY a.id
) tab1
order by tab1.time_is desc) tab2
group by tab2.grp_is