InfluxDB - return measurements that show an anomaly as defined by the difference between subsequent measurements

I have a atble in InfluxDB, which has some values. So what I wanted to do is that I wanted to calculate the difference changing with values. Here is my query:

SELECT * FROM (SELECT DIFFERENCE(value) FROM table) WHERE difference = 1;

And I wanted to select all values from the table, where detected difference is 1 an then since DIFFERENCE() function returns second value of difference between two values from the table I wanted to get this second value from the table, because I want to create a function for an anomaly that is detected between measurements A and B, where time(a) < time(b) and this function should return B. Has anyone have an idea how can I do that with a single InfluxDB query?