Jump to content

Peter58

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Peter58

  1. Hi, i have a problem with my sql query, I tried everything but until now not the right results.
    Problem :
    I have two tables, One  that is called Alarms and the other one Logs.
    From Alarms I want to use the fields Machine, Message en datetime which is in 2020-02-27 19:11:54:123 format.  In the table Logs I have the fields Anode and Datetime also in 2020-02-27 19:11:54:123  format.
    When a alarms occurs I want to use the datetime field to look for the Anode in the other table Logs with the same Datetime value but only on the whole second, I want only one value back.
    So the ouput would be someting like 
    Machine, Message ,Datetime,Anode 
    I believe I have to use the LEFT JOIN instruction :
    SELECT Machine,Message,DateTime,Anode
    FROM Table1.Alarms
    LEFT JOIN Logs
    ON table1.DateTime = table2.DateTime;  
    Can Anyone help me with this ?
    Thanks in advance, Peter


     

×
×
  • Create New...