Ad Widget

Collapse

SQL Query of tables triggers and items using table functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheLion
    Junior Member
    • Aug 2018
    • 2

    #1

    SQL Query of tables triggers and items using table functions

    It's seem to be a simple task, but I can't figure it out.
    I want to create a table that contains a item name and the lastchange value of it's related trigger. I tried using the functions table to relate them, but my SQL Query return 0 rows. Can someone help?
    This is my Query:
    Code:
    SELECT
      t1.name as "File",
      to_timestamp(t3.lastchange) AT TIME ZONE '-3' as "Time"
    from
      (SELECT itemid, name  from items where name like 'HorĂ¡rio%' and hostid = 10084) t1
      join (SELECT triggerid, itemid from functions) t2 on t1.itemid = t2.itemid
      join (SELECT triggerid, lastchange from triggers) t3 on t2.triggerid = t3.triggerid
Working...