How to Query the Database to Find a Page with a Specific Label

Still need help?

The Atlassian Community is here for you.

Ask the community

Reason

To find all the pages created by a certain user and containing a specific label. 

Procedure

Run the following query in the database:

SELECT * FROM CONTENT 
WHERE CONTENTID IN (SELECT CONTENTID FROM CONTENT_LABEL 
					WHERE LABELID IN (SELECT LABELID FROM LABEL 
						WHERE NAME='<label name>' AND OWNER IN (SELECT USER_KEY FROM USER_MAPPING WHERE LOWER_USERNAME = '<username>')));

Be sure to replace <label name> with the actual label name you're looking for, and <username> with the username you're looking for.

You may need to modify the query for your database.

Last modified on Aug 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.