title: How to SELECT LAST PING as "seconds" from a table in SQL
body: <p>I'm trying to write just a simple sql query on an observability platform like Grafana that will check if a server is up and running - On my database there is a table called ping and what it does is that it usually sends ping request every 15mins to check if the server is up and then stores all the records on the ping table.</p>
  <p>I would like to create a query on Grafana sp if I don't get any ping from the server in 15mins, I would be able to see it on Grafana so I can set alerts.</p>
  <pre><code>SELECT DATE_FORMAT((
      SELECT timeint 
      from mio.nyp_ping 
      ORDER BY timeint DESC 
      LIMIT 1) , '%Y-%M-%D-%H-%') AS Result;
  
  2022-February-3rd-10-02
  </code></pre>
  <p>Trying to achieve something like this as an SQL query so I can run it on Grafana:</p>
  <p>Metric:</p>
  <pre><code>SELECT (NOW() - LAST PING ) as &quot;seconds from last ping&quot;
  </code></pre>