Named Query with where clause of datetime not working properly

Hi,
I have written simple query.

I had put value as "2023-08-01" future date as I don't have any data, however output is giving all the datas available in the database.

1689306148108 = Friday, July 14, 2023 9:12:28.108 AM
1689306535620 = Friday, July 14, 2023 9:18:55.620 AM

You will need to convert your datetime parameter to match the epoch timestamp format.
Something like

WHERE t_stamp >= DATEDIFF(s, '1970-01-01 00:00:00.000', :start)

I'd make the NQ parameter a bigint and convert to UTC milliseconds before the NQ.

Pssst! Why are you directly querying the historian's tables? That is a snake pit of complexity you should avoid (by using Ignition's tag history functions).

Getting error
java.sql.SQLSyntaxErrorException: Incorrect parameter count in the call to native function 'DATEDIFF'

Not sure why, I just tested it and it works just fine for me with the exact same setup.
I do notice your start date is set in the future though, but I do not believe that would cause that error.

What version of SQL Server are you running?

Add your filter parameter value to the return list as a sanity check. Something like this:

SELECT t_stamp, floatvalue, :start as Filt1
FROM sqlt_data_1_2023_07
WHERE t_stamp > :start
ORDER BY t_stamp

You didn't respond to Phil's question about why you are querying a history table directly. The built-in Tag History binding feature will get you what you want and sort out all the table partitioning behind the scenes.

Can you explain why you are writing your own query?

Sorry for the late reply,
I am using MySQL Workbench 8.0.33

For below issue I am trying to find a solution.

I was thinking of creating 2 tags for same variable, 1 for reading and 1 for writing and while saving the data in to the database I will have 2 tagID, for this reason I am trying to find a way like this.