JSON/q

A JSON-based data access specification

When invoked on a grouping, the 'all' operator selects groups where every object in the grouping cause the evaluation to return true.

Query

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

Results

{}