AVEVA Plant SCADA Forum
A support forum for AVEVA Plant SCADA (formerly Citect SCADA). Share new and exciting product information, connect, learn, and collaborate with the ecosystem of Plant SCADA Users. AVEVA Plant SCADA a reliable, flexible and high-performance Supervisory Control and Data Acquisition software solution for industrial process customers. This forum is to connect, share, learn and collaborate new and exciting product information. Feel free to join and share to your Ecosystem of Plant SCADA Users.
Posted: 2021-04-05 12:53 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-05 12:53 AM
Hello
I am making a SQL query to a MySQL database.
When I run the query in MySQL, I get the right result.
When I send the SQL statement from Machine SCADA Expert, the result is not right.
It is like the lase WHERE clause is ignored.
This is the Query:
SELECT SUM(Minute_In_State) From
(SELECT
Time_Stamp,
State,
TIMESTAMPDIFF(SECOND, LAG(Time_Stamp) OVER(ORDER BY Time_Stamp), Time_Stamp)
AS Minute_In_State
FROM db.xyz_1_state
ORDER BY Time_Stamp) AS T
Where State = 1;
Any suggestion why the result is different, when sent from Machine SCADA Expert?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-07 03:25 AM
The input field "SQL statement" is limited to 10 lines, the rest of the statement is not saved.
The solution is to make the SQL statement in one line.
This makes it way more difficult to oversee the statement, but it works.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-06 12:30 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-06 12:30 AM
I found the connection string from Machine SCADA Expert, where the last WHERE clause is missing:
Connection String:'26F9D15629', Last command: 'Cursor Open SQL: 'SELECT SUM(Second_In_State) From
(SELECT
Time_Stamp,
State,
TIMESTAMPDIFF(SECOND, LAG(Time_Stamp) OVER(ORDER BY Time_Stamp), Time_Stamp)
AS Second_In_State
FROM db.xyz_1_state
ORDER BY Time_Stamp) AS T, Total Connections: 1]
So the problem must be in Machine SCADA Expert.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-04-07 03:25 AM
The input field "SQL statement" is limited to 10 lines, the rest of the statement is not saved.
The solution is to make the SQL statement in one line.
This makes it way more difficult to oversee the statement, but it works.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.