Help with SQL query using group by

Hi,

Currently I want to to achieve smth but I don’t know if it’s possible using influxSQL. I have a set of data like:

file_id, status
1,         0
1,         1
2,         0
2,         1

About the data above, entries are inserted sequentially when specific status is changed. What I want to achieve is having a list of entries in Grafana Table where I show only the latest status of the of the file so, the output of the above would be:

file_id, status
1,         1
2,         1

In case that we don’t have yet an entry with status = 1 for specific file we will have only:

file_id, status
1,         1
2,         0

Hope is clear, thx!