---
schema_version: "1"
id: 30359e82c46090582b7e135286fc7d87be1fd4075891e14a664b05d9cbb24be7
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/platform/salesforce-soql-sosl/guides/soql-sosl/sforce-api-calls-soql-relationships-query-datacat.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-query-datacat.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ab8cdc8a473576a42b2d65858ef617155253fe1e25890b61b5597138d3da210c
products:
  - SOQL and SOSL Reference
  - Platform 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'
```
