# InfluxDB - top(field, N) relevant fields are wrong

**URL:** <https://community.influxdata.com/t/influxdb-top-field-n-relevant-fields-are-wrong/4034>\
**Category:** Store\
**Tags:** influxdb, influxql\
**Created:** [February 16, 2018, 7:20am UTC](https://community.influxdata.com/t/influxdb-top-field-n-relevant-fields-are-wrong/4034 "2018-02-16T07:20:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_Kindernay](https://avatars.discourse-cdn.com/v4/letter/o/a88e4f/32.png) [@Oliver\_Kindernay](https://community.influxdata.com/u/Oliver_Kindernay)\
**Post date:** [February 16, 2018, 7:20am UTC](https://community.influxdata.com/t/influxdb-top-field-n-relevant-fields-are-wrong/4034/1 "2018-02-16T07:20:22Z")

</div>

I have following query with which I am trying to select top 10 values of measurement, along with another field in that measurement.

`> SELECT top("value", 10), "auto_id" FROM "stat.series.log_book.computation" WHERE time >= 1518684004169ms and time <= 1518684121709ms ORDER BY time DESC`

```
time top auto_id
---- --- -------
1518684005662000000 1.21402096748352 6182
1518684015269000000 1.2542519569397 6182
1518684024488000000 1.21754097938538 6182
1518684028575000000 0.888169050216675 6182
1518684034943000000 1.04962706565857 6182
1518684036717000000 0.870682954788208 6182
1518684041304000000 9.79708886146545 6182
1518684072901000000 1.25484204292297 6182
1518684095342000000 0.876681089401245 6182
1518684107811000000 1.19542217254639 6182

```

which looks fine until I look at the points returned like this:

```
> select time, auto_id, value from "stat.series.log_book.computation" WHERE time >= 1518684004169ms and time <= 1518684121709ms AND value > 0.87;
name: stat.series.log_book.computation
time auto_id value
---- ------- -----
1518684005662000000 8910 1.21402096748352
1518684015269000000 8910 1.2542519569397
1518684024488000000 8910 1.21754097938538
1518684028575000000 11583 0.888169050216675
1518684034943000000 1701 1.04962706565857
1518684036717000000 11583 0.870682954788208
1518684041304000000 7907 9.79708886146545
1518684072901000000 8920 1.25484204292297
1518684095342000000 11583 0.876681089401245
1518684107811000000 8910 1.19542217254639

```

This shows that the auto\_id field in the top() query result is wrong. I am clearly missing something here. I want the result of the second query, but using the top function. Can this be achieved?

---

<div class="post-metadata">

**Author:** ![mopy](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@mopy](https://community.influxdata.com/u/mopy)\
**Post date:** [March 25, 2018, 1:17am UTC](https://community.influxdata.com/t/influxdb-top-field-n-relevant-fields-are-wrong/4034/2 "2018-03-25T01:17:18Z")

</div>

I have the same issue as well. It seems that the relevant field value is the same in all the results and comes from the last entry in that range.

Any ideas?

---

<div class="post-metadata">

**Author:** ![mopy](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@mopy](https://community.influxdata.com/u/mopy)\
**Post date:** [March 29, 2018, 5:25am UTC](https://community.influxdata.com/t/influxdb-top-field-n-relevant-fields-are-wrong/4034/3 "2018-03-29T05:25:52Z")

</div>

Wondering if others have run into the same issue and/or have suggestions? It seems that top(N) is not quite useful without this, as I can’t extract other columns/field values that are associated with those top results.
