# Error in Workbench with SQL

**URL:** <https://forum.opensearch.org/t/error-in-workbench-with-sql/17101>\
**Category:** OpenSearch\
**Created:** [December 15, 2023, 7:11am UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101 "2023-12-15T07:11:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juergen](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Juergen](https://forum.opensearch.org/u/Juergen)\
**Post date:** [December 15, 2023, 7:11am UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101/1 "2023-12-15T07:11:48Z")

</div>

**Open search 2.11.0**

Hi All,

I’ve a problem with the Workbench and SQL.

This sql works:  
select dummyfield from dummyindex

And this works too:  
select count(dummyfield) from dummyindex

But this doesn’t work:  
slect dummyfidld, count(dummyfield) from dummyindex

The error is:  
Dummyindex: Bad Request, this query is not runnable.

What happens?

This is a correct sql-statement…

Thanks for helping me.

Regards  
Juergen

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [December 15, 2023, 1:40pm UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101/2 "2023-12-15T13:40:55Z")

</div>

@Juergen I’m not sure what are you trying to achieve with this SQL query.

The count() function returns only a single line with an integer value, whereas the other query will return all matching rows.

Could you share the expected outcome?

---

<div class="post-metadata">

**Author:** ![Juergen](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Juergen](https://forum.opensearch.org/u/Juergen)\
**Post date:** [December 15, 2023, 2:30pm UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101/3 "2023-12-15T14:30:01Z")

</div>

I want something like that:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/9/9058ab06b9cf42b28383517abfce3080d3c7c310.png)

I want to get a table with two columsn. One with Name/label and a second with the counter for the name/label. The example has not the same columns/rows. It#s for illusration…

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [December 15, 2023, 5:55pm UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101/4 "2023-12-15T17:55:24Z")

</div>

@Juergen That query looks completely different.  
In that case, this should work.

```auto
slect dummyfield, count(dummyfield) from dummyindex group by dummyfield

```

This is my example executed on the security audit index.

```auto
select audit_transport_request_type.keyword, count(audit_transport_request_type.keyword) 
from security-auditlog-2023.12.15 
group by audit_transport_request_type.keyword

```

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/1/1b057f08221916889381199e977d7d8d8e25eb1f.png)

---

<div class="post-metadata">

**Author:** ![Juergen](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Juergen](https://forum.opensearch.org/u/Juergen)\
**Post date:** [December 19, 2023, 6:25am UTC](https://forum.opensearch.org/t/error-in-workbench-with-sql/17101/5 "2023-12-19T06:25:51Z")

</div>

Hello Pablo,

yes that’s it . Blame on me. I’ve should known it …  
Some kind of SQL-Blackout. 😉

Thanks a lot.

Regards  
Juergen
