I ran a query to retrieve data from the same table in MSSQL and in ignition "Named queries" but the results were not the same. Therefore, I did a manual calculation using Excel and it was matched with MSSQL output.
I wanted to get monthly averaged data from the table<
Same as I ran the query per monthly(one by one) on Ignition DB and those values were matched with MSSQL output.
What could be the reason?
It looks like we are dealing with three fields on which you want to perform some aggregate functions and miscellaneous functions. Ignition is not the best at handling complex SQL, so I would create a stored procedure that returns the dataset you are looking for. You might be able to create a function (?) to handle the formatting and conversion of the field t_stamp as well.
Your named query then would call the SP, passing any parameters as needed.