---
title: "MDQueryGetCountOfResultsWithAttributeValue(_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1413009-mdquerygetcountofresultswithattr
---

# MDQueryGetCountOfResultsWithAttributeValue(_:_:_:)

Returns the number of results which have the given attribute and attribute value.

## Declaration

```swift
func MDQueryGetCountOfResultsWithAttributeValue(_ query: MDQuery!, _ name: CFString!, _ value: CFTypeRef!) -> CFIndex
```

## Parameters

- `query`: The query.
- `name`: The attribute name to return the result count of. If the attribute is not one of those requested in the valueListAttrs parameter, the behavior is undefined.
- `value`: The attribute value for which to return the number of results with that value. This parameter may be NULL, in which case the number of results that do not contain the specified attribute is returned.

## Return Value

Return Value The number of results containing that attribute and value.

## Discussion

Discussion This count may change over time if the query allows live-updates.

## See Also

### Getting Query Result Values

- [MDQueryCopyValuesOfAttribute(_:_:)](coreservices/1413105-mdquerycopyvaluesofattribute.md)
- [MDQueryGetAttributeValueOfResultAtIndex(_:_:_:)](coreservices/1413046-mdquerygetattributevalueofresult.md)
- [MDQueryGetIndexOfResult(_:_:)](coreservices/1413093-mdquerygetindexofresult.md)
- [MDQueryGetResultAtIndex(_:_:)](coreservices/1413055-mdquerygetresultatindex.md)
- [MDQueryGetResultCount(_:)](coreservices/1413008-mdquerygetresultcount.md)
- [MDQuerySetSortComparatorBlock(_:_:)](coreservices/1413021-mdquerysetsortcomparatorblock.md)
