> For the complete documentation index, see [llms.txt](https://docs.buildings.ability.abb/collection/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.buildings.ability.abb/collection/platform/alarms-rules-and-escalations/rule-chains/nodes/sql-query.md).

# SQL Query

## ![](/files/Wgh3HBKhQcq2uSa01o1X)

Use **SQL Query** to run a SQL query inside a rule chain.

This node returns query results for downstream nodes.

<div align="left"><figure><img src="/files/W3YQK0BC6EEg5iIv8gtW" alt="" width="337"><figcaption></figcaption></figure></div>

### What it does

The node runs the configured SQL statement when triggered.

Use it to fetch data for later processing.

### Inputs and outputs

**Input**

* **Trigger** — Starts the query.

**Output**

* **Data** — Returns the query result.

### Configurable settings

<div align="left"><figure><img src="/files/zNShj5CgvygXEj9gKSe4" alt="" width="375"><figcaption></figcaption></figure></div>

* **SQL Query** — Enter the SQL statement to execute.

### Typical use

Use **SQL Query** before **LLM Call** or other processing nodes.

### Related documentation

* [Script Engine](/collection/platform/platform-core/script-engine.md)
* [Writing PL/PgSQL Scripts](/collection/platform/platform-core/script-engine/writing-pl-pgsql-scripts.md)
* [Nodes](/collection/platform/alarms-rules-and-escalations/rule-chains/nodes.md)

For the full editor flow, see [Configure Rule Chain](/collection/platform/alarms-rules-and-escalations/rule-chains/configure-rule-chain.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.buildings.ability.abb/collection/platform/alarms-rules-and-escalations/rule-chains/nodes/sql-query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
