> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Ambiguous column name

> Resolve the error returned when an SQL query references a column name that exists in more than one table.

## Error message

```text wrap theme={null}
Compilation error: ambiguous column name
```

This error can appear when using [transformation components](https://docs.maia.ai/docs/components/transformation-pipeline-overview.md), typically [Calculator](https://docs.maia.ai/docs/components/calculator.md) or [Join](https://docs.maia.ai/docs/components/join.md).

### Explanation

An SQL query references a column name that exists in more than one table.

### Potential causes

Two joined tables each contain a column with the same name, and a downstream component references the column without disambiguation.

***

## Resolve the error

1. Use the [Rename](https://docs.maia.ai/docs/components/rename.md) component to rename any columns with the same name before they're referenced by downstream components.
2. If you need to keep the column names the same, make sure that any SQL expressions that reference these columns specify the table containing the referenced column. For example, if both `table_a` and `table_b` contain a `name` column, use `SELECT table_a.name FROM table_a` in the expression.
3. Re-run the pipeline.
4. If you still need help, [contact Maia Support](https://support.matillion.com/s/) and include the items listed below.

   * The full error text.
   * The root pipeline execution ID.
   * The Maia runner ID and time of failure (UTC).

### Prevent future errors

To prevent this error occurring again:

* [Sample the data](https://docs.maia.ai/docs/guides/sampling-output.md) as you build your pipeline, so that you can make sure no columns have the same name.
* Use the [Rename](https://docs.maia.ai/docs/components/rename.md) component to give any columns with the same name unique names before you join your tables.


## Related topics

- [SQL compilation error in the warehouse](https://docs.maia.ai/docs/errors/sql-compilation-error-in-the-warehouse.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.