JSON/q

A JSON-based data access specification

When invoked on a grouping, the 'any' operator selects groups where any of the objects in the grouping cause the evaluation to return true.

Query

{
  "group": {
    "into": "g", 
    "by": "p.category"
  }, 
  "as": "p", 
  "from": "Products", 
  "where": "g.any( p.unitsInStock == 0 )", 
  "select": {
    "category": "g.key", 
    "products": "g"
  }
}

Results

{}