Explore > Queries > Coding query

Coding query

Coding queries can help you to test ideas, explore patterns and see the connections between the themes, topics, people and places in your project.

To see what has been coded to a code, double-click it in the List View to open it. You can use Coding queries to find content coded to selected codes, a combination of codes, or cases with particular attribute values.

You could use a Coding query to:

  • Gather material coded to combinations of codes—for example, gather content coded to green policy and conservative government and explore the associations.
  • Gather material from cases with specific attribute values—for example, what do young farmers say about alternative energy?
  • Search for content coded to multiple codes and use operators to further refine the query—for example, what do young farmers say about alternative energy?
  • Search for content that is not coded to a specific code—find content coded to solar power but not coded to alternative energy.

A Coding query will only find content that has been coded. For example, if you ask the question what do fishery employees say about rising sea levels?—make sure you have coded content to the code rising sea levels and to codes with the attribute fishery employee.

Create a Coding query

If you are not familiar with NVivo queries, you may want to create your query using the Wizard—the Wizard guides you through the process of setting your query criteria. However, not all query features are available in the Wizard, so you may sometimes want to create your query outside the Wizard.

When the query has finished running, the results are displayed as a temporary preview in Detail View.


  • To save query settings so you can run a query again later, click Save Criteria. Name the query criteria file and optionally add a description. The file is saved under Queries / Query Criteria in the Navigation View.
  • Use the Save Results button to set your preferences for storing the results—for example, you might want to store the results as a code when you run the query.

Examples of Coding query criteria

The following examples show how you can build advanced query criteria to answer specific questions:

To answer the question

Do this

What do fishery employees say about rising sea levels?

Build a query where all of the following are true:

  • Content coded to the selected code Rising sea levels
  • Content coded to any case where the case classification for Person:Occupation = fishery employee

Is there a connection between rising sea temperatures and coral bleaching?

Build a query where all of the following are true:

  • Content coded to Rising sea temperatures
  • Near all overlapping content coded to Coral bleaching

What memorable quotes have Henry or Wanda found about habitat or landscape ?

Build a query where all of the following are true:

  • Content coded to Memorable quotes
  • Content coded to Habitat or Landscape
  • Content coded by Henry or Wanda

View the results

When you run a Coding query the results are shown as a preview in Detail View.

Click on the tabs displayed on the right to see different views of the results.

  • Summary lists the files that contain the content that matches the query criteria.
  • Reference displays the content that was returned by the query.

Other tabs may be visible depending on the file types that are included in the results.

Save the preview results as a code

If your query has returned interesting content, you may want to save it as a code, so that you can explore it further. For example, you might find all the content coded to water quality and development. You can save the results to a new code that holds your evidence that Development negatively impacts water quality.

The code will contain the content displayed on the Reference tab in the query results in Detail View. If you repeatedly run the same query, you may want to merge the references into an existing code, rather than create them as a new code.

  1. Click the Save Results button at the top of Detail View.
  2. Next to Option, choose whether you want to create results as a new code or merge into an existing code.
  3. If you are creating a new code, enter a name and description.
  4. Click OK

NOTE  By default new codes are created in the Query Results folder, unless you choose another location.

Use a Compound query to refine your Coding query

You can use a Compound Query to further refine a Coding query, for example you could:

  • Combine two Coding queries to find content coded to Code A when it precedes content coded to Code B.
  • Combine a Coding query with a Text Search query to find text in relation to coding—where young women talk about climate change, do they use the word pessimistic?