Socrata was acquired by Tyler Technologies in 2018 and is now the Data and Insights division of Tyler. The platform is still powered by the same software formerly known as Socrata but you will see references to Data & Insights going forward.

The $having Parameter

The $having parameter allows you to filter your results of an aggregation using boolean operators, similar to the HAVING clause in SQL. For example, to aggregate our earthquakes and get only the sources with more than 500 quakes:

https://soda.demo.socrata.com/resource/4tka-6guv.json?$select=source, count(*) as count&$group=source&$having=count > 500

Multiple boolean operators are available to combine filters:

OperatorDescriptionExample
ANDThe logical and of two expressions.a AND b will return true ONLY if a and b are both true.
ORThe logical or of two expressions.a or b will return true if either a or b are true.
NOTThe logical not of an expression.NOT a will return true, ONLY if a is false.
IS NULLWhether a value is null or not.a IS NULL will return true, ONLY if a is null.
IS NOT NULLWhether a values is not null.a IS NOT NULL will return true, ONLY if a is not null
( ... )Parentheses are used for defining order of operations.b>3 AND (a=1 OR a=2)
close