DISTINCT
The Historian OLE DB Provider supports the use of DISTINCT
in a SELECT
statement. DISTINCT
eliminates duplicate rows when all columns are equal. Floating-point values, however, may not compare as expected, depending on the precision. For example, if the numbers to the right of the decimal point are not equal for all values, similar columns are not eliminated. The columns must be exactly equal to be eliminated.
Example 1: Retrieve the Set of Unique Data Types Used in an Archive
SELECT DISTINCT datatype FROM ihtags
Example 2: Retrieve the Set of Tags With Raw Data Samples on a Specific Date
SELECT DISTINCT tagname FROM ihRawData WHERE samplingmode=rawbytime
AND timestamp>='11/28/2001' AND timestamp<='11/29/2001'