Looking for some help with this tricky SQL query grouping. I have below set of data. I am looking to find time difference of first (in1=1 & inputs=9) row and first in1=0