---
title: "How to Query Approved and Unapproved Pages in Confluence Using SQL"
canonical: "https://support.appfire.com/space/SUPPORT/985696472/How%20to%20Query%20Approved%20and%20Unapproved%20Pages%20in%20Confluence%20Using%20SQL"
format: markdown
---
> Macro (toc)

Confluence users often need to identify which pages with the Page Approval app macro added have been approved and which have yet to be approved. This article provides SQL queries to retrieve this information directly from the database, allowing administrators to manage content approvals more effectively.

## \uD83D\uDCD8 Instructions

### **Prerequisites**

- access to the Confluence database
- necessary permissions to run SQL queries against the Confluence database

### **Queries to Retrieve Page Approval Status**

**List of approved pages:**   
Use the following SQL query to list all pages that have been approved:

```
SELECT C.title AS PageTitle, O.entity_id AS PageID, O.entity_key, O.string_val AS ApprovalStatus
FROM OS_PROPERTYENTRY O
JOIN CONTENT C
	ON O.entity_id = C.contentid
WHERE O.entity_key LIKE '%pageapprovalapprovalstate%'
AND O.string_val = 'true'
AND C.version = Cast (right(entity_key,1) as integer)
GROUP BY C.title, O.entity_id, O.entity_key, O.string_val;

```

**List of unapproved pages:**   
Use the following SQL query to list all pages that have not been approved:

```
SELECT C.title AS PageTitle, O.entity_id AS PageID, O.entity_key, O.string_val AS ApprovalStatus
FROM OS_PROPERTYENTRY O
JOIN CONTENT C
	ON O.entity_id = C.contentid
JOIN BODYCONTENT BC
	ON O.entity_id = BC.contentid
WHERE O.entity_key LIKE '%pageapprovalapprovalstate%'
AND O.string_val = 'false'
AND C.version = Cast (right(entity_key,1) as integer)
AND BC.body LIKE '%ac:name="pageapproval"%'
GROUP BY C.title, O.entity_id, O.entity_key, O.string_val;
```

> ℹ️ The query for unapproved pages only displays a list of pages that contain the Page Approval macro but have not yet been approved.

By using these SQL queries, Confluence administrators can effectively manage and monitor the approval status of pages, facilitating better content management and workflow processes.