# Newest or oldest insertion

**URL:** <https://community.influxdata.com/t/newest-or-oldest-insertion/1131>\
**Category:** Systems\
**Tags:** influxdb\
**Created:** [May 31, 2017, 5:33am UTC](https://community.influxdata.com/t/newest-or-oldest-insertion/1131 "2017-05-31T05:33:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Indeed\_1](https://avatars.discourse-cdn.com/v4/letter/i/85e7bf/32.png) [@Indeed\_1](https://community.influxdata.com/u/Indeed_1)\
**Post date:** [May 31, 2017, 5:33am UTC](https://community.influxdata.com/t/newest-or-oldest-insertion/1131/1 "2017-05-31T05:33:41Z")

</div>

Hey

How can i find newest or oldest insertion on influxdb?

Thanks,

---

<div class="post-metadata">

**Author:** ![jackzampolin](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jackzampolin/32/5_2.png) [@jackzampolin](https://community.influxdata.com/u/jackzampolin)\
**Post date:** [May 31, 2017, 4:09pm UTC](https://community.influxdata.com/t/newest-or-oldest-insertion/1131/2 "2017-05-31T16:09:59Z")

</div>

@Indeed_1 We have [some functions](https://docs.influxdata.com/influxdb/v1.2/query_language/functions) to help out with that. Please at least try to look at the documentation before posting here.

---

<div class="post-metadata">

**Author:** ![Indeed\_1](https://avatars.discourse-cdn.com/v4/letter/i/85e7bf/32.png) [@Indeed\_1](https://community.influxdata.com/u/Indeed_1)\
**Post date:** [June 3, 2017, 7:17am UTC](https://community.influxdata.com/t/newest-or-oldest-insertion/1131/3 "2017-06-03T07:17:22Z")

</div>

@jackzampolin Would you please write an example , I’ve read all document before post something here but neither I don’t understand it or it’s vague!

Thanks,

---

<div class="post-metadata">

**Author:** ![jackzampolin](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jackzampolin/32/5_2.png) [@jackzampolin](https://community.influxdata.com/u/jackzampolin)\
**Post date:** [June 5, 2017, 5:23pm UTC](https://community.influxdata.com/t/newest-or-oldest-insertion/1131/4 "2017-06-05T17:23:35Z")

</div>

@Indeed_1 The first and last functions are what you are looking for

```auto
select last(*) from cpu where time > now() - 1m
select first(*) from cpu where time > now() - 1m

```
