Forum Discussion
wannestal
1 year agoNew Member
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...
- 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')
lbendlin
1 year agoSuper User
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')