# SQL Editor

Acho Team understands that sometimes the desired data transformation action to be performed is just too complex or inefficient to be done via a sequence of available actions. This is why Acho offers a SQL editor to allow our advanced users proficient in SQL to have the flexibility to perform more advanced actions. The SQL Editor on Acho supports [standard SQL syntax](https://docs.acho.io/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-sql-queries) and [functions](https://docs.acho.io/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-math-functions-in-formula).&#x20;

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-McBeEv2W31OozWBxbN1%2F-McBeQ5dOie12XP18_Cg%2Fimage.png?alt=media\&token=129983f0-5126-40f8-8615-76e27aea8158)

### **Troubleshooting**

1. The SQL Editor does not support lin&#x65;**-**&#x6C;evel execution. That is, everything in the editor will be executed all at once. Therefore, please make sure to include a semicolon `;` at the end of the query and not to have empty lines after the semicolon `;`. Also, the SQL Editor cannot include more than two queries at a time, that is, more than two semicolons `;`.
2. All table names must have a prefix of `SQL_EDITOR_` and a suffix of `_TABLE`.
3. When using the `JOIN` or `UNION` statements, you have to [import all needed tables](https://docs.acho.io/acho-studio/data-prep-projects/applying-actions/tools/broken-reference) into the project first. The SQL Editor can only access tables within the current project.
4. when using the  `JOIN` statement, if there are two columns with the same name, the query will run into an error. join a table to itself. For example, if you join a table to itself (that is `SELF JOIN`) and select all columns, then an error occurs due to duplicate column names.

```
SELECT *
FROM SQL_EDITOR_us_states_TABLE AS A
LEFT JOIN us_states AS B
ON A.state_name = B.state_name 
```

You have can change your query like the following.

```
SELECT A.state_name AS state_name, B.state_name AS state 
FROM SQL_EDITOR_us_states_TABLE AS A
LEFT JOIN us_states AS B
ON A.state_name = B.state_name 
```

#### Learn more supported SQL queries:

{% content-ref url="sql-editor/supported-sql-queries" %}
[supported-sql-queries](https://docs.acho.io/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-sql-queries)
{% endcontent-ref %}

{% content-ref url="sql-editor/supported-math-functions-in-formula" %}
[supported-math-functions-in-formula](https://docs.acho.io/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-math-functions-in-formula)
{% endcontent-ref %}
