Click or drag to resize
sqx

COUNTIF Structure

Aggregate [bigint] COUNTIF([bit] Truth)

Namespace:  sqx
Assembly:  SQX (in SQX.dll) Version: 1.0.2.6 (1.0.2.6)
Syntax
C#
[SerializableAttribute]
public struct COUNTIF
Remarks
Count if aggregate function.
Return COUNT_BIG(*) where Truth = 1.

Attributes

Format.Native, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = true, IsNullIfEmpty = true
Examples
SQL
;WITH sample_data AS (SELECT sqx.BernoulliD_PPF(Value, 0.6) [Truth] FROM sqx.UTable(1000,NULL))
SELECT sqx.COUNTIF([Truth]) K, COUNT(*) N
FROM sample_data
GO 10
SQL
;WITH sample_data AS (SELECT ID, Value FROM sqx.UTable(1000,NULL))
SELECT sqx.COUNTIF((CASE WHEN Value <= 0.6 THEN 1 ELSE 0 END)) K, COUNT(*) N
FROM sample_data
GO 10
See Also