> For the complete documentation index, see [llms.txt](https://docs.layraweb.com.tr/merhaba/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layraweb.com.tr/merhaba/sql-tarafi/sql-hatalari-ve-cozumleri/subquery-returned-more-than-1-value..md).

# Subquery returned more than 1 value.

Bu hata, bir alt sorgunun, bir WHERE, IN veya HAVING ifadesi içinde veya bir SELECT ifadesinde kullanıldığında, alt sorgunun birden fazla değer döndürmesi durumunda ortaya çıkar. Bu hatanın nedeni, ana sorgunun, alt sorgunun döndürdüğünden daha fazla veriye sahip olmasıdır.

Örneğin, aşağıdaki sorguda, alt sorgunun döndürdüğü birden fazla değer nedeniyle bu hatayı alabilirsiniz:

```sql
SELECT name FROM customers WHERE id = (SELECT customer_id FROM orders)
```

Bu hatayı çözmek için alt sorgunun yalnızca bir değer döndürmesini sağlamak gereklidir. Bunun için alt sorguda kullanılan WHERE veya IN ifadesini düzenleyebilir veya alt sorgunun sonucunu birkaç kayıt döndürmek yerine yalnızca bir kayıt döndürecek şekilde değiştirebilirsiniz. Bu, bir LIMIT ifadesi kullanarak veya alt sorgunun TOP 1 gibi bir kısıtlama ekleyerek yapılabilir.

Örneğin, yukarıdaki örnek sorguyu aşağıdaki gibi düzenleyebilirsiniz:

```sql
SELECT name FROM customers WHERE id = (SELECT TOP 1 customer_id FROM orders)
```

Bu şekilde, alt sorgu yalnızca bir kayıt döndürecektir ve hatanın önüne geçilecektir.

Regenerate response


---

# 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.layraweb.com.tr/merhaba/sql-tarafi/sql-hatalari-ve-cozumleri/subquery-returned-more-than-1-value..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.
