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 table with a item name and it's related triggers' lastchange value, I've tried using the functions table to relate my query but it results 0 rows. What am I doing wrong?
    Code:
    SELECT
      t1.name as "Arquivo",
      to_timestamp(t3.lastchange) AT TIME ZONE '-3' as "HorĂ¡rio de Recebimento"
    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...