---
schema_version: "1"
id: 8a337f679002c28bfb74e07bde7ade4be1c656b4b8888f38da828bd00955104f
title: Using Relationship Queries with Data Category Selection Objects
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/knowledge/guides/sforce-api-calls-soql-relationships-query-datacat.md
canonical_url: https://developer.salesforce.com/docs/service/salesforce-knowledge-dev-guide/guide/sforce-api-calls-soql-relationships-query-datacat.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5932c0c4b106985ec37aa3c4bc408deb04529d986586e01824a250013698dc13
products:
  - Salesforce Knowledge Developer Guide
  - Service Cloud Developer Content
---

# Using Relationship Queries with Data Category Selection Objects

Data categories are used to classify records. In SOQL, you can use the*Article*\_\_DataCategorySelection or QuestionDataCategorySelection objects. You can also build a relationship query with the `DataCategorySelections` relationship name in a `FROM` clause.

Imagine an `Offer` article type. The following query returns the ID of any categorization associated with an offer and the ID of the categorized article.

```soql
SELECT Id,ParentId
FROM Offer__DataCategorySelection

```

The following example uses the `DataCategorySelections` relationship name to build a relationship query that returns the ID of published offers and the ID of all the categorizations associated to these offers.

```soql
SELECT Id, Title,
  (
    SELECT Id
    FROM DataCategorySelections
  )
FROM Offer__kav WHERE PublishStatus='online'
```
