Query help sql date range between grouping 7am to 7am

I need to join the query I worked on from this thread to the one you helped me with in another thread
here

As much as the duration query looks at t_stamp, when I join it, I can still join on t_stamp, and the duration query’s references to t_stamp for getting time won’t be impacted?
Or do i join on like machine name, and then will that mean references to like durationTable.t_stamp will not be impacted?
The queries are so big, that it is hard for me to retain how they are in my mind.

I join on the inner most table?

so far my attempts to join have been unsuccessful like not compiling

or is there a way to join the tables on format(dateadd(hh,-8, t_stamp), 'yyyy-MMM-dd')

like joining on a subquery, is it a thing you can do?


I thought recursion was to code fast at the cost of efficiency, and should be avoided.