I am trying to select tags and other properties from these tables between two dates and eventually select tags from a specified date range on one minute increments, as tags are uploaded every few seconds. Currently my last AND statement does not seem to be selecting my tags from the specified date range I want. I am looking into this and have seen similar posts but am stuck on why 1: I am not getting these from the date range below. 2: How to select tags between date range on 1 minute increments...
SELECT TOP (1000) FloatTable.[DateAndTime]
,FloatTable.[Millitm]
,FloatTable.[TagIndex]
,FloatTable.[Val]
,FloatTable.[Status]
,FloatTable.[Marker]
,TagTable.[TagName]
,TagTable.[TagType]
,TagTable.[TagDataType]
FROM [FactoryTalk_Datalog].[dbo].[FloatTable] as FloatTable
JOIN [FactoryTalk_Datalog].[dbo].[TagTable] as TagTable
on FloatTable.[TagIndex] = TagTable.[TagIndex]
WHERE TagTable.[TagName] = '[PLC]FI225'
OR TagTable.[TagName] = '[PLC]FI250'
OR TagTable.[TagName] = '[PLC]FI220'
OR TagTable.[TagName] = '[PLC]AT_FI510'
OR TagTable.[TagName] = '[PLC]AT_AI500'
OR TagTable.[TagName] = '[PLC]SS_FIT1109'
AND FloatTable.[DateAndTime] BETWEEN '2022-04-01 23:53:00.000' AND '2022-04-01 23:58:00.000'
I have tried specifying the date up front and then the tags which works but then pulls in all tags and I need select few tags.
I have looked at other stack posts that work for two dates but they are selecting all and not a set of certain items as listed above.