Re: Help for a create un trigger
Quote
I need to fill in a data_diff field to warn how many days I do not receive communication from the device
No, you don't.
This time-based value will change all the time (pun intended).
This is data that can be
derived from other data that you already have, i.e. the date on which you last received data from each device:
select
a.id_Autotest
, now() - data_ultimo intervallo
from autotest_ping a
inner join
(
select id_Autotest
, max( data_arrivo ) data_ultimo
from autotest_ping
group by id_Autotest
) b
on a.id_Autotest = b.id_Autotest
order by 2 desc, 1 ;
Of coourse, an index on id_Autotest and data_arrivo would help this query
a lot.
Regards, Phill W.
Subject
Written By
Posted
February 05, 2023 08:59AM
Re: Help for a create un trigger
February 06, 2023 08:36AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.