For AI agents: an index of this documentation is at https://developer.rippling.com/llms.txt. Public pages have a Markdown version at the same URL with .md added.

Skip to main content
guide

Write a custom SQL query in a report

Add one SQL query to a report to generate new fields, then join those fields to the rest of the report.

Use with AI:Rippling AI ChatGPT Claude Cursor

This guide explains how to add a custom SQL query to a report and edit the query later.

You can use SQL in a report to generate new fields and join those fields with other data in the report.

Keep the following limitations in mind:

  • You can add only one SQL query to each report.
  • The query is saved only within the report where you created it.
  • You cannot reuse the query in other reports.
  • The query is not saved as a custom data object in Rippling.

Add a SQL query to a report​

  1. With your report open for editing, hover over Custom SQL in the Available data panel and click the [+] icon.
  2. The Edit SQL window opens. Write your SQL query. Refer to the SQL Reference Glossary for information about what’s supported.
  3. To test your query, click Run in the top right corner and review the output in the window below the editor.
  4. When your query is complete, click Validate and apply in the top right corner.
  5. Wait while the query is validated. If the validation fails, you’ll see an error message to let you know why. Go back to the prior screen or close the modal and make any necessary adjustments to your query.
  6. When the query passes validation, click Continue.

The fields that were created as the output of your query are added to the Selected fields area.

Just like when you add data to a report from any other dataset, Rippling automatically joins the fields you created with the other data in the report. You can adjust the joins as needed by clicking the pencil icon next to Joins at the bottom of the Available data panel. For more information, see Joins in reports.

Edit the SQL query in a report​

If you want to change the SQL query, there are two ways to open it for editing:

  • Hover over Custom SQL in the Available data panel and click the pencil icon.
  • In the Filters & controls panel at the top of the page, click Edit SQL.

The SQL editor window opens. Make your changes, then follow the steps above to validate and save your query.

See also​