Forum Discussion

wannestal's avatar
wannestal
New Member
1 year ago
Solved

Using IN in sql statement

Hi, I want to pull data from a table in a database with this statement. It works, but returns only the records with the first datetime in the 'IN' clause (08/27/2024 03:34:05). For information: the...
  • lbendlin's avatar
    1 year ago

    Use ISO-8601 formatting, always.

     

    You need to protect the OR part from the AND part. 

     

    Select DateTime, Tagname, Value FROM table WHERE TagName IN ('P124' ,'P132') AND DateTime IN ('08/27/2024 03:34:05', '08/27/2024 02:07:46', '08/27/2024 03:30:05')