# Sql\_last\_value not working properly

**URL:** <https://discuss.elastic.co/t/sql-last-value-not-working-properly/227244>\
**Category:** Logstash\
**Created:** [April 9, 2020, 6:01am UTC](https://discuss.elastic.co/t/sql-last-value-not-working-properly/227244 "2020-04-09T06:01:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jgabor](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jgabor](https://discuss.elastic.co/u/jgabor)\
**Post date:** [April 9, 2020, 7:38am UTC](https://discuss.elastic.co/t/sql-last-value-not-working-properly/227244/2 "2020-04-09T07:38:56Z")

</div>

This looks like the problem I had two years ago: [JDBC to ElasticSearch: duplicate records?](https://discuss.elastic.co/t/jdbc-to-elasticsearch-duplicate-records/150153)

tldr: try to put an order\_by updated\_at to your query

---

_[View the full topic](https://discuss.elastic.co/t/sql-last-value-not-working-properly/227244)._
