Use an arithmetic function
- Last UpdatedMar 19, 2025
- 1 minute read
The following query adds the values of two tags from the WideHistory table.
SELECT * FROM OpenQuery(INSQL,'
SELECT DateTime, ReactLevel, ProdLevel, "Sum" = ReactLevel+Prodlevel
FROM WideHistory
WHERE DateTime > "2001-02-28 18:56"
AND DateTime < "2001-02-28 19:00"
AND wwRetrievalMode = "Cyclic"
')
The results are:
|
DateTime |
ReactLevel |
Prodlevel |
Sum |
|
2001-02-28 18:56:00.000 |
1525.0 |
2343.0 |
3868.0 |
|
2001-02-28 18:56:00.000 |
1525.0 |
2343.0 |
3868.0 |
|
2001-02-28 18:56:00.000 |
1525.0 |
2343.0 |
3868.0 |
|
2001-02-28 18:56:00.000 |
1525.0 |
2343.0 |
3868.0 |
|
2001-02-28 18:56:00.000 |
2025.0 |
2343.0 |
4368.0 |
|
2001-02-28 18:56:00.000 |
2025.0 |
2343.0 |
4368.0 |
|
... |
|||
|
(100 row(s) affected) |
If you use a math operator, such as plus (+), minus (-), multiply (*), or divide (/), you will need to add a blank space in front of and after the operator. For example, "Value - 2" instead of "Value-2".