National Instruments BridgeVIEW Manual De Usuario
Appendix B
Citadel and Open Database Connectivity
B-6
© National Instruments Corporation
Assume, for example, that you want to find out how many times a
compressor motor started in December. You also want to know its total
runtime for the month. The following query provides the answers:
compressor motor started in December. You also want to know its total
runtime for the month. The following query provides the answers:
SELECT "Starts{MotorRun}",
"ETM{MotorRun}"
FROM Threads
WHERE LocalTime >= "12/1/95"
AND LocalTime < "1/1/96"
AND Interval = "31"
SQL Examples
The following examples are typical query statements; however, your
queries may be much more involved, depending on your system
requirements.
queries may be much more involved, depending on your system
requirements.
•
Retrieves the most recent (current) value of every tag logged to
Citadel.
Citadel.
SELECT *
FROM Threads
•
Retrieves the value of every tag logged today in one second
increments.
increments.
Note the interval value is specified within
quotation marks.
SELECT *
FROM Threads
WHERE Interval=“0:01”
•
Retrieves and time-stamps the value of
Powder
in one second
increments from 8:50 this morning to now. Tag names are surrounded
by quotes.
by quotes.
SELECT LocalTime, “Powder”
FROM Threads
WHERE LocalTime>“8:50”
AND Interval=“0:01”
•
Retrieves and time-stamps the value of
Liquid
input in one minute
intervals for the month of October. Also indicates the input’s highest
occurring value within each minute.
occurring value within each minute.
SELECT LocalTime, “Liquid”, “Max{Liquid}”
FROM Threads
WHERE LocalTime>“10/1/96”
AND LocalTime<“11/1/96”
AND Interval=“1:00”