# How to multiply two columns and then sum the result in ElasticSQL?

**URL:** https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201
**Category:** Elasticsearch
**Tags:** elastic-stack-sql
**Created:** [February 6, 2019, 1:12am UTC](https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201 "2019-02-06T01:12:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Miguel\_Plazas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel_plazas/32/40038_2.png) [@Miguel\_Plazas](https://discuss.elastic.co/u/Miguel_Plazas)
#### Post date: [February 6, 2019, 1:12am UTC](https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201/1 "2019-02-06T01:12:37Z")

</div>

Hi I would like to subtrac one value to one column, then multiply two columns, and finally sum the result:

```auto
SELECT SUM(column_a*(column_b-1)) AS result FROM table_1 WHERE column_c='G' AND column_d='H' AND column_b>1.00

```

but in **ElasticSQL** from **Elasticsearch** i'm getting this error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "sql_illegal_argument_exception",
        "reason": "Does not know how to convert argument Mul[] for function Sum[]"
      }
    ],
    "type": "sql_illegal_argument_exception",
    "reason": "Does not know how to convert argument Mul[] for function Sum[]"
  },
  "status": 500
}

```

Any idea to solve it?

---

<div class="post-metadata">

### Author: ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)
#### Post date: [February 7, 2019, 6:58am UTC](https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201/2 "2019-02-07T06:58:31Z")

</div>

@Miguel_Plazas thank you for trying out ES-SQL and for reporting things that you would like to use with it. The functionality you are looking for is not possible at the moment in ES-SQL. But, there is an enhancement request [already created here](https://github.com/elastic/elasticsearch/issues/36865).

---

<div class="post-metadata">

### Author: ![Miguel\_Plazas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel_plazas/32/40038_2.png) [@Miguel\_Plazas](https://discuss.elastic.co/u/Miguel_Plazas)
#### Post date: [February 7, 2019, 9:26pm UTC](https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201/3 "2019-02-07T21:26:06Z")

</div>

Thanks Andrei! I understand!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 7, 2019, 9:26pm UTC](https://discuss.elastic.co/t/how-to-multiply-two-columns-and-then-sum-the-result-in-elasticsql/167201/4 "2019-03-07T21:26:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
