Calculate periode of status change

Hi there,
I have a table for a parking sensor which sends a state for occupied (1) and vacant (9).
Now I want to create a query which shows me the time period between the status changes so that I can create a report for the time the parkingslot was occupied and free.
Can someone help me for creating a query for this?

Please provide more context.
Some sample data?
Do you need a flux or a InfluxQL query?

Thanks for your response.
The table data has actually the following structure:
name: parkinginfo


hope that helps.

Unfortunately not. Please provide sufficient context.

Where is this data located? In InfluxDB? Or is this your input data?
Which InfluxDB version?
Do you need a flux or a InfluxQL query?

Sorry, my fault.
The data is generated by the parking sensor and inserted via node-red into the influxdb.
The data is located in InfluxDB version 1.8.10 on Ubuntu 20.04.
I would need a InfluxQL query.