# Influx DB delete some measurments

**URL:** <https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452>\
**Category:** General\
**Created:** [20 December 2021 06:26 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452 "2021-12-20T06:26:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [20 December 2021 06:26 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/1 "2021-12-20T06:26:16Z")

</div>

Hello  
i know not a Node Red Problem. but the better Forum to get help!  
i still use Influx DB 1.8x

a Sensor send wrong data Temperatur over 7000 Degree.  
i would like to delete them i find the wrong entry and delete them with the correct timestamp.  
but can't find out how to say

> DELETE FROM GOE\_RAW WHERE temperature \> 60  
> ERR: shard 6: fields not supported in WHERE clause during deletion

have a nice day  
vinc

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 December 2021 07:18 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/2 "2021-12-20T07:18:21Z")

</div>

Assuming that a SELECT WHERE with that condition works, then do that and then run through then and delete using the time in the WHERE clause.  
It may be possible to do the same with a clever nested query, but if it is a one off issue then I would do it the simple way.  
Make sure your database backup is up to date first, of course, and inspect the results from the first query before passing it on to the second.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 December 2021 11:31 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/3 "2021-12-20T11:31:09Z")

</div>

Apart from @Colin's suggestion you could copy everything into a new measurement and filter  
out the records you don't need. Then delete the contents of the first measurement and copy back:

```auto
SELECT * INTO <destination_measurement> FROM <source_measurement> [WHERE <criteria>] GROUP BY *

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 December 2021 11:49 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/4 "2021-12-20T11:49:24Z")

</div>

@ghayne I believe that would create a new set of time stamps messing up any graphing by time.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 December 2021 11:53 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/5 "2021-12-20T11:53:29Z")

</div>

You might be right Paul, but easy to check.

[EDIT] Timestamps are preserved using the above method!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 December 2021 14:25 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/6 "2021-12-20T14:25:07Z")

</div>

> [@ghayne](#):
>
> `SELECT * INTO <destination_measurement> FROM <source_measurement> [WHERE <criteria>] GROUP BY *`

Is the GROUP BY clause necessary there ?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 December 2021 15:44 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/7 "2021-12-20T15:44:28Z")

</div>

I think it is Colin, I seem to remember it stops tags being converted to fields in the target table. I haven't got a table with tags to try it.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [20 December 2021 15:57 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/8 "2021-12-20T15:57:54Z")

</div>

@Colin, from the documentation:

```auto
The GROUP BY * clause preserves tags in the source database
 as tags in the destination database.

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 December 2021 16:12 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/9 "2021-12-20T16:12:54Z")

</div>

Good catch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 February 2022 16:13 UTC](https://discourse.nodered.org/t/influx-db-delete-some-measurments/55452/10 "2022-02-18T16:13:06Z")

</div>

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