# Please help with Elasticsearch SQL Error: "Does not know how to convert argument Div\[\] for function Max\[\]"

**URL:** <https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [December 18, 2018, 10:59am UTC](https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308 "2018-12-18T10:59:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![999chris](https://avatars.discourse-cdn.com/v4/letter/9/f17d59/32.png) [@999chris](https://discuss.elastic.co/u/999chris)\
**Post date:** [December 18, 2018, 10:59am UTC](https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308/1 "2018-12-18T10:59:54Z")

</div>

I'm getting the error on the following:

```
SELECT AVG(((dateupdated-datecreated) + 0.0) / (DURATIONMILLIS + 0.0)) AS "Ratio" FROM "mip*" WHERE key = 'ottvod' AND WORKFLOWSTATUSID = 0 GROUP BY 'PROVIDERID'

```

Elasticsearch SQL is (I suppose understandably, not very well documented) so I cant find a way around this err.

---

<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:** [December 19, 2018, 8:14am UTC](https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308/2 "2018-12-19T08:14:59Z")

</div>

@999chris `dateupdated`, `datecreated` and `DURATIONMILLIS` are fields in these indices?

---

<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:** [December 19, 2018, 10:11pm UTC](https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308/3 "2018-12-19T22:11:47Z")

</div>

@999chris in any case, I've raised [https://github.com/elastic/elasticsearch/issues/36865](https://github.com/elastic/elasticsearch/issues/36865) to improve the support for AVG like groupings.

---

<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:** [January 16, 2019, 10:11pm UTC](https://discuss.elastic.co/t/please-help-with-elasticsearch-sql-error-does-not-know-how-to-convert-argument-div-for-function-max/161308/4 "2019-01-16T22:11:49Z")

</div>

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