Change Query from 1.8 to 2.0 Db influx

I want to change this flow and it is currently running on db1.8. but I want to use it with db2.0. The queries have changed.
Can someone help me to create the right query?

[
    {
        "id": "7e76473157e64de4",
        "type": "influxdb in",
        "z": "22bb2ce990740b9b",
        "influxdb": "d49556922db36022",
        "name": "Abfrage",
        "query": "select * from \"KSEM\".\"KSEM2\" order by time desc Limit 1",
        "rawOutput": false,
        "precision": "s",
        "retentionPolicy": "",
        "org": "smarthome",
        "x": 320,
        "y": 1080,
        "wires": [
            [
                "5df5518c97863b87"
            ]
        ]
    },
    {
        "id": "ae39b4755d370594",
        "type": "inject",
        "z": "22bb2ce990740b9b",
        "name": "jede Minute",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 110,
        "y": 1080,
        "wires": [
            [
                "7e76473157e64de4"
            ]
        ]
    },
    {
        "id": "5df5518c97863b87",
        "type": "function",
        "z": "22bb2ce990740b9b",
        "name": "Influx",
        "func": "let Bez_M = msg.payload[0].Bezug;\nlet Ein_M = msg.payload[0].Einsp;\nlet Bez_T = msg.payload[1].Bezug;\nlet Ein_T = msg.payload[1].Einsp;\nmsg.payload = {Bez_M,Ein_M,Bez_T,Ein_T};\nmsg.topic = \"täglich & monatlich\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 1080,
        "wires": [
            [
                "6eed8a16b4174014"
            ]
        ]
    },
    {
        "id": "96f3e127a909ad43",
        "type": "join",
        "z": "22bb2ce990740b9b",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 470,
        "y": 1120,
        "wires": [
            [
                "6eed8a16b4174014"
            ]
        ]
    },
    {
        "id": "6eed8a16b4174014",
        "type": "join",
        "z": "22bb2ce990740b9b",
        "name": "",
        "mode": "custom",
        "build": "merged",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "6",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 690,
        "y": 1080,
        "wires": [
            [
                "096d0b59bafc40bb"
            ]
        ]
    },
    {
        "id": "a2805ed26f8df196",
        "type": "cronplus",
        "z": "22bb2ce990740b9b",
        "name": "jede Minute",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "Bezug Zähler",
                "topic": "Bez",
                "payloadType": "flow",
                "payload": "Bezug",
                "expressionType": "cron",
                "expression": "0 * * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "Einspeisung Zähler",
                "topic": "Ein",
                "payloadType": "flow",
                "payload": "Einsp",
                "expressionType": "cron",
                "expression": "0 * * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 110,
        "y": 1120,
        "wires": [
            [
                "96f3e127a909ad43"
            ]
        ]
    },
    {
        "id": "096d0b59bafc40bb",
        "type": "function",
        "z": "22bb2ce990740b9b",
        "name": "Werte",
        "func": "let Bez_T = msg.payload.Bez - msg.payload.Bez_T;\nlet Bez_M = msg.payload.Bez - msg.payload.Bez_M;\nlet Ein_T = msg.payload.Ein - msg.payload.Ein_T;\nlet Ein_M = msg.payload.Ein - msg.payload.Ein_M;\nmsg.payload = {Bez_M,Bez_T,Ein_M,Ein_T};\nObject.entries(msg.payload).forEach((v) =>{\n    msg.payload[v[0]] = Math.round(v[1]*100)/100;\n})\nmsg.topic = \"Auswertung\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 1080,
        "wires": [
            [
                "58554023b0d4e2fb",
                "f08d22bd27e93e41",
                "1f5be3028323fe0b",
                "01e3cee029bfe671"
            ]
        ]
    },
    {
        "id": "58554023b0d4e2fb",
        "type": "ui_text",
        "z": "22bb2ce990740b9b",
        "group": "cab6742689765c7e",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Einspeisung heute",
        "label": "<b><font color=orange> Einspeisung",
        "format": "{{msg.payload.Ein_T}} kWh",
        "layout": "row-spread",
        "className": "",
        "x": 1010,
        "y": 1060,
        "wires": []
    },
    {
        "id": "1f5be3028323fe0b",
        "type": "ui_text",
        "z": "22bb2ce990740b9b",
        "group": "e95a7cdc52bfdb3e",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Einspeisung Monat",
        "label": "<b><font color=orange> Einspeisung",
        "format": "{{msg.payload.Ein_M}} kWh",
        "layout": "row-spread",
        "className": "",
        "x": 1010,
        "y": 1100,
        "wires": []
    },
    {
        "id": "f08d22bd27e93e41",
        "type": "ui_text",
        "z": "22bb2ce990740b9b",
        "group": "cab6742689765c7e",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "Bezug heute",
        "label": "<b><font color=red> Bezug",
        "format": "{{msg.payload.Bez_T}} kWh",
        "layout": "row-spread",
        "className": "",
        "x": 990,
        "y": 1140,
        "wires": []
    },
    {
        "id": "01e3cee029bfe671",
        "type": "ui_text",
        "z": "22bb2ce990740b9b",
        "group": "e95a7cdc52bfdb3e",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "Bezug Monat",
        "label": "<b><font color=red> Bezug",
        "format": "{{msg.payload.Bez_M}} kWh",
        "layout": "row-spread",
        "className": "",
        "x": 990,
        "y": 1180,
        "wires": []
    },
    {
        "id": "d49556922db36022",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "db",
        "name": "InfluxDB",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "2.0",
        "url": "http://192.168.178.16:8086",
        "rejectUnauthorized": false
    },
    {
        "id": "cab6742689765c7e",
        "type": "ui_group",
        "name": "Heute",
        "tab": "64033f10e63bd8ab",
        "order": 3,
        "disp": true,
        "width": "5",
        "collapse": false,
        "className": ""
    },
    {
        "id": "e95a7cdc52bfdb3e",
        "type": "ui_group",
        "name": "Monat",
        "tab": "64033f10e63bd8ab",
        "order": 4,
        "disp": true,
        "width": "5",
        "collapse": false,
        "className": ""
    },
    {
        "id": "64033f10e63bd8ab",
        "type": "ui_tab",
        "name": "Tageswerte",
        "icon": "trending_up",
        "order": 5,
        "disabled": false,
        "hidden": false
    }
]

Do you mean you want to know what query you need to run (which is nothing to do with node-red)? If so then we don't need a flow, just tell us what the query is for 1.8.

select * from "KSEM"."KSEM2" order by time desc Limit 1 = 1.8 Influx DB

what should the query be for 2.0 influxdb?

Which part of the query don't you know how to do?
If you don't know anything about how to do it then start with Get started with Flux | Flux 0.x Documentation

Unfortunately I didn't understand that.

Would like feed today, feed month,

KSM tag

KSM2 month

Perhaps you would be better sticking with version 1.8 then.

from(bucket: "db")
  |> range(start: -1d)
  |> filter(fn: (r) => r._measurement == "KSEM" and r._field == "Bezug")
  |> filter(fn: (r) => hourSelection(r._time))
  |> last()
  |> map(fn: (r) => ({value: r._value}))

hourSelection = (t) => hour(t) >= 0 and hour(t) <= 23
 compilation failed: error @4:24-4:46: expected comma in property list, got DOT error @4:39-4:45: unexpected token for property key: DOT (.)

Which line is it that is failing? I don't know how to interpret the error message. You can find out by building the query up a bit at a time.

If it is the hourSelection bit, then hourSelection() is a built in function, so you can do things like
|> hourSelection( start: 8, stop: 19)
if that is what you are trying to achieve. So you don't need to provide your own version.

LOL thats my flow :ok_hand:
I use influx 1.6.x

Power values ​​from the Pv from the last day 0-24 hours, how much power was generated last day.

yes i need it on db2.0

If you want it for the full 24 hours then you don't need the hourselection at all. Each filter down the chain only removes records, so if you have already selected the day that you want then you don't need to select which hours you want, as you want all of them.